0

[  
   {  
      "s.no":0,
      "amt.pledged":15823,
      "blurb":"'Catalysts, Explorers & Secret Keepers: Women of Science Fiction' is a take-home exhibit & anthology by the Museum of Science Fiction.",
      "by":"Museum of Science Fiction",
      "country":"US",

I want to access a element of a json object in which the key contains a '.' in Javascript In this image the "s.no" contains '.' so how can i access the value of "s.no"

Suraj Kumar
  • 281
  • 6
  • 13
  • Welcome to Stack Overflow. Please read [the guide for good questions](https://stackoverflow.com/help/how-to-ask) and come back with a relevant version. – GalAbra Jan 28 '18 at 16:24
  • Welcome to Stack Overflow! Please take the [tour], have a look around, and read through the [help], in particular [*How do I ask a good question?*](/help/how-to-ask) Don't post code, markup, data, etc. as pictures; post them **as text**. Why: http://meta.stackoverflow.com/q/285551/157247 – T.J. Crowder Jan 28 '18 at 16:25
  • The answer is to use brackets notation (see the linked question's answers for details), e.g. `var data = JSON.parse(str); console.log(data[0]["s.no"]);` will give you `0`. – T.J. Crowder Jan 28 '18 at 16:25

1 Answers1

1

You can use myObj["s.no"] after it's been parsed.

li x
  • 3,953
  • 2
  • 31
  • 51