Fixed README to call encode and decode in method format

pull/7/head
Flaghacker 2018-02-03 16:55:45 +01:00
parent e1dbe93f7c
commit aef54f5f28
1 changed files with 2 additions and 2 deletions

View File

@ -21,13 +21,13 @@ The library provides the following functions:
#### json.encode(value) #### json.encode(value)
Returns a string representing `value` encoded in JSON. Returns a string representing `value` encoded in JSON.
```lua ```lua
json.encode({ 1, 2, 3, { x = 10 } }) -- Returns '[1,2,3,{"x":10}]' json:encode({ 1, 2, 3, { x = 10 } }) -- Returns '[1,2,3,{"x":10}]'
``` ```
#### json.decode(str) #### json.decode(str)
Returns a value representing the decoded JSON string. Returns a value representing the decoded JSON string.
```lua ```lua
json.decode('[1,2,3,{"x":10}]') -- Returns { 1, 2, 3, { x = 10 } } json:decode('[1,2,3,{"x":10}]') -- Returns { 1, 2, 3, { x = 10 } }
``` ```
## Notes ## Notes