Link to home
Start Free TrialLog in
Avatar of stargateatlantis
stargateatlantis

asked on

parsing json in jquery

Lets say you back-end returns the following code

[{"key1":1,"key2":2"}]

How would you parse the JSON notice the square brackets
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Please note you've an extra double quote at the end
var a = '[{"key1":1,"key2":2}]';
a = $.parseJSON(a);
var b = $.isArray([{"key1":1,"key2":2}]); // return true if it's an array -> brackets

Open in new window

SOLUTION
Avatar of zappafan2k2
zappafan2k2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stargateatlantis
stargateatlantis

ASKER

How would you loop thru the key values
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial