File size: 2,574 Bytes
d7bb13e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
1.36 Json .292
1.36.1 Json.Decode .292
1.36.2 Json.DecodeFromString .293
1.36.3 Json.Encode .293

Json
Json. Decode
Brief
Decode a JSON structure (held in a memory container) into a table.
Definition
Json.Decode( MemoryContainer in, number offset = -1, size = -1 )
Arguments
in - The memory container holding the JSON-formatted block.offset - Offset into the container where the JSON structure begins.size - The size of
the JSON structure.
Return Values
A table containing the decoded data structure, or a negative number on error.
-1 - Invalid argument.
-2 - Parse error.
Description
This function parses a JSON-formatted data structure held in the provided memory container, and returns a corresponding Lua table. Arrays will
be treated as key-value pairs with the array index as the key (the base index will be 1).
Examples
container = MemoryContainer.Create ( 1024 )
See Also
� Json.DecodeFromString
� Json. Encode
Json.DecodeFromString
Brief
Decode a JSON structure (held in a string) into a table.
Definition
Json.DecodeFromString( string in )
Arguments
in - A string holding a JSON-formatted data structure.
Return Values
A table containing the decoded data structure, or a negative number on error.
-1 - Invalid argument.
-2 - Parse error.
Description
This function parses a JSON-formatted data structure and returns a corresponding Lua table. Arrays will be treated as key-value pairs with the
array index as the key (the base index will be 1).
Examples
decoded = Json.DecodeFromString(
"{\"session\":{\"@expires\":\"1314268686648V� ,\"@id\":\"3a50cfb2\",\"person\":{\"@id\":\"e8a41543\",\"di^
)
See Also
� Json.Decode
� Json. Encode
Json.Encode
Brief
Encode a table into JSON format, storing the results in the provided memory container.
Definition
number Json.Encode( MemoryContainer out, table in )
Arguments
out - The memory container to write the JSON-encoded data into.in - The table to be encoded.
Return Values
The number of bytes written to the output memory container, or a negative number on error.
-1 - Invalid argument.
-2 - Not enough space in the memory container.
-3 - Unable to encode table in the JSON format.
Description
Write out a JSON-formatted data structure representing the given table to the provided memory container. The structure of the table must conform
to the JSON specification.
Examples
testtable =
{"session":{"service":{"@id":"bb88aea9","display_name":"Testing"},"person":{"@id":"e8a41543","display_nari
= MemoryContainer.Create( 1024 )
result = Json.Encode( container, testtable )
See Also
� Json.Decode
� Json.DecodeFromString