Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieve values from json in javascript

 
pravin rasal
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to get the values from JSON in javascript following is my code

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Objects do not have a length. You need a for in loop.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that really how you indent your code?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Is that really how you indent your code?


I think it is a copy paste thing. I have had stuff like that happen. Where it is perfectly indented in my IDE, then I copy and paste the code here, or elsewhere in my code and there ends up being more indentention than in the actual code.

Mark
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using tabs for indentation, perhaps? I always use spaces -- makes the code look as intended everywhere.

And even so, making the code easy to read helps posters get help. So it's worth any extra time it takes to make sure that posted code has proper indentation that makes the code easy to read.

Hard-to-read-code == moving on to next post with easier-to-read code.
 
pravin rasal
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic