en fr

Disponible uniquement en anglais

Sysquake Pro – Table of Contents

Sysquake – Table of Contents

Sysquake for LaTeX – Table of Contents

Extension - JSON

This section describes functions which encode and decode JSON data. JSON means JavaScript Object Notation; it is a text format based on the syntax of JavaScript for storing literal values. It is described in RFC 8259.

json2obj

Convert JSON in a string to a structure or list.

Syntax

s = json2obj(str)

Description

json2obj(str) converts the data represented in string str with JSON format into a structure or a list. Objects are converted to structures and arrays to lists. Names must be compatible with LME field names.

Examples

json2obj('{"a":true,"b":"abc","c":12.345e2}')
  a: true
  b: 'abc'
  c: 1234.5
json2obj('[true,"abc",12.345]')
  {true,'abc',12.345}

See also

obj2json, str2obj

obj2json

Convert a structure or list to JSON.

Syntax

str = obj2json(s)

Description

obj2json(s) converts structure or array s (list, cell array, or array of type double or logical) to JSON in a string. If s is of type double or logical, it must be an array of at least two elements; if it is a list or structure, it must not be empty. Nested empty structures or arrays are converted to JSON null value.

Example

obj2json({'abc', [], [2,3]})
  '[\n"abc",\nnull,\n[\n2,\n3\n]\n]'

See also

json2obj