This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

AngularJS : Parsing JSON Object inside AngularJS controller

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am using AngualrJS and via factory call getting a response and it returns a JSON object.
{"0":"Sample_IS_Action.xml","1":"Sample_IS_Action_123.xml","2":"Sample_SOAP_Action.xml","3":"Sample_SOAP_IS_Action.xml"}
But inside my controller i am not able to retrieve the data entries as it gives Object,object.

Please suggest how to parse the JSON object to get the values
Sample_IS_Action.xml
Sample_IS_Action_123.xml
Sample_SOAP_Action.xml
Sample_SOAP_IS_Action.xml

Thanks,
Faraz
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what the problem is. The parsed JSON will indeed be an object. What else were you expecting? Or are you saying that the JSON is still in String format?

 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Faraz Ka wrote:I am using AngualrJS and via factory call getting a response and it returns a JSON object. ... But inside my controller i am not able to retrieve the data entries as it gives Object,object


  • In order to stay independent of the browser implementation of the window JSON object, JSON objects are serialized in AngularJS with angular.toJson.
  • JSON strings are de-serialized with angular.fromJson.
  • A JSON object de-serialized with JSON.parse isn't necessarily of type "JSON" - so Object.prototype.toString.call(jsonObject) will return "[object Object]" rather than "[object JSON]".

  •  
    Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it:
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
      Bookmark Topic Watch Topic
    • New Topic