login about faq

Just curious how i load json string that starts as array [ ie

    [
       {
          "id":200
       },
       {
          "id":196
       }
    ]
At the moment i cheat a bit and prefix the string it with { "array": and post fix with } and then use jsonobject.load(string) It works, but i assume there is a correct way?

asked Jun 16 at 08:21

chilkat's gravatar image

chilkat ♦♦
11.8k316358421


Your cheat is likely the best solution. A JSON object must begin with "{". See http://www.json.org/

An array is just one particular kind of value:

object {} { members } members pair pair , members pair string : value array [] [ elements ] elements value value , elements value string number object array true false null

link

answered Jun 16 at 08:24

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×17
×2
×1

Asked: Jun 16 at 08:21

Seen: 237 times

Last updated: Jun 16 at 08:24

powered by OSQA