JSON

Parsing

There is also a JSON parser available. You can use it to parse JSON objects that you get from event subscriptions, Particle function calls, BLE, TCP, UDP, Serial, etc..

There are some limitations to be aware of:

  • The entire object must be stored in RAM.
  • The parser modifies the buffer, so if you have a buffer that you cannot modify, it will need to be copied into RAM.
  • Grabbing values by key name or array elements by index is cumbersome.
  • Unicode strings are not supported. All strings must be 7-bit ASCII, but double quote, backslash, and control characters are unescaped.

However, it is a fast and efficient parser, and since the JSMN parser is part of Device OS, it saves on code space.