User Tools

Site Tools


mmbasic:json_examples

JSON Examples

The MMBasic JSON$ function can be used to extract a value from a JSON string stored in an MMBasic LONGSTRING.
JSON$(array%(), string$)

Here are a couple of TBS threads referring to its use.
Picomite JSON parsing question
Json$ parsing help

FIXME

 Add some details of structure expected by MMBasic and how to access indexed values. 
  
From threads above. 
"The json listed doesn't conform to the norm. There should be an outer name and then 
you could access as an array. e.g."
  {
  "users": [
    { "name": "Alice", "age": 30 },
    { "name": "Bob", "age": 25 }
  ]
  }

  users[1].name

  Try appending a name at the beginning and a close bracket at the end as in my example 
  and see if the json$ function then works. 
mmbasic/json_examples.txt · Last modified: by Gerry