Parse nodes with equal keys

Anonymous
2012-01-18
2013-04-22
  • Anonymous - 2012-01-18

    Hello,
    Suppose we have json:
    {
      "item" : {
        "val1" : 1
      },
      "item" : {
        "val2" : 2
      },
      "item" : {
        "val3" : 3
      }
    }
    jsoncpp parse it ok, but root node have one child node only and it is the last: "item" : {  "val3" : 3 }
    Is this a bug or feature?

     
  • Tim Drijvers

    Tim Drijvers - 2012-01-18

    Seems like perfectly normal behavior to me. Test in Chrome:

    a = { 'b': {'a': 1}, 'b' : {'a': 2}, 'b': {'a': 3} }
    a.b.a
    3
    
     
  • Anonymous - 2012-01-18

    Yes, but i hope you guess that people use json not only in javascript.
    Actually i store data in bson format, in json we just describe data that later convert to bson. In C# i used json parser by Newtonsoft which work fine and such i want.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks