krrr25
krrr25

Reputation: 679

Issue in parsing a JSON numeric value

I having a JSON value which returns from the server. I can.t Parse this value. Find the below JSON value

{"Result":{"d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM":"FROM"}}

If i try to get the value like

console.log(Result.d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM);
console.log(Result[d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM]);

It throws error

SyntaxError: identifier starts immediately after numeric literal

Upvotes: 0

Views: 404

Answers (1)

super
super

Reputation: 2328

Try this:

var obj = {"Result":{"d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM":"FROM"}};

console.log(obj.Result["d8bf6ab7-21a2-4964-a2cf-e7a1db097f08_FROM"]);

Upvotes: 1

Related Questions