variable to json
This function loads JSON contents from a text string into a variable. This approach is useful if JSON text has been obtained
from other sources, for example a table.
If the specified variable is existing then all contents will be deleted before the loading procedure starts. The members (and sub-members)
will be built up while loading / reading in is in progress.
Indirect parameter passing is disabled
1, 3
No. | Type | Description |
---|---|---|
1, etc. code |
variable :string |
Source variable name The contents will be loaded into this variable. |
Opt. 2 input |
string | JSON Format Following values are supported:
JSON: Save JSON in nice format with every item in a separate line and text indentation used |
Type | Description |
---|---|
string | JSON contents Contains JSON text of saved variable |
a[] = Hello World;
j[] = variable to json( a[] );
echo("Simple variable in JSON: ", j[] );
json to variable( b[], j[], JSON B4P );
see(b[]);
Simple variable in JSON: [ "Hello World"]
b[] Hello World (quoted string,full access)