Mercurial > octave
changeset 28626:34696240591e
doc: Improve JSON documentation.
* doc/interpreter/strings.txi: New section "JSON decoding/encoding".
* libinterp/corefcn/jsondecode.cc (Fjsondecode): Improve docstring.
author | Abdallah Elshamy <abdallah.k.elshamy@gmail.com> |
---|---|
date | Thu, 20 Aug 2020 23:12:47 +0900 |
parents | 173807014259 |
children | 0da2fbd3a642 |
files | doc/interpreter/strings.txi libinterp/corefcn/jsondecode.cc |
diffstat | 2 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/strings.txi Tue Aug 18 15:22:48 2020 +0900 +++ b/doc/interpreter/strings.txi Thu Aug 20 23:12:47 2020 +0900 @@ -63,6 +63,7 @@ * Comparing Strings:: * Manipulating Strings:: * String Conversions:: +* JSON decoding/encoding:: * Character Class Functions:: @end menu @@ -535,6 +536,17 @@ @DOCSTRING(undo_string_escapes) +@node JSON decoding/encoding +@section JSON decoding/encoding + +JavaScript Object Notation, in short JSON, is a very common human readable +and structured data format. GNU Octave supports decoding and encoding this +format with the following two functions. + +@DOCSTRING(jsondecode) + +@DOCSTRING(jsonencode) + @node Character Class Functions @section Character Class Functions
--- a/libinterp/corefcn/jsondecode.cc Tue Aug 18 15:22:48 2020 +0900 +++ b/libinterp/corefcn/jsondecode.cc Thu Aug 20 23:12:47 2020 +0900 @@ -420,10 +420,12 @@ of decoding @var{json}. For more information about the options @qcode{"ReplacementStyle"} and -@qcode{"Prefix"}, see @ref{matlab.lang.makeValidName}. +@qcode{"Prefix"}, see +@ref{XREFmatlab_lang_makeValidName,,matlab.lang.makeValidName}. -NOTE: It is not guaranteed to get the same JSON text if you decode -and then encode it as some names may change by @ref{matlab.lang.makeValidName}. +and then encode it as some names may change by +@code{matlab.lang.makeValidName}. This table shows the conversions from JSON data types to Octave data types: @@ -439,7 +441,8 @@ @item JSON @qcode{"Object"} Scalar @qcode{"struct"} (field names of the struct may be different from -the keys of the JSON object due to @ref{matlab.lang.makeValidName}) +the keys of the JSON object due to +@ref{XREFmatlab_lang_makeValidName,,matlab.lang.makeValidName}) @item @qcode{"Array"} of different data types @qcode{"Cell"} array