Skip to content

Commit

Permalink
Update scriptfuncs.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mohabhassan authored Aug 11, 2019
1 parent 67e6ff3 commit 5f3bf91
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/scriptfuncs.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,43 @@ local.result[matches][1] = a

This option uses standard c++ library regex parser, regex_match is used when `whole_match` is 1 otherwise regex_search is used. Visit [cppreference](https://en.cppreference.com/w/cpp/regex) for more info.


---
#### json_parse
json_parse(string json_string)
Parse given `json_string` into a variable.


Example:
```
local.result = json_parse "{ \"happy\": true, \"pi\": 3.141 }"
```
Result:
```
local.result will be an array having the following structure:
local.result.size = 2
local.result[happy]: 1
local.result[pi]: 3.141
```

---
#### json_stringify
json_stringify(variable var)
Convert given `var` into a json string.


Example:
```
local.result = json_stringify "{ \"happy\": true, \"pi\": 3.141 }"
```
Result:
```
local.result = json_stringify aaa::bb::cc
local.result = {"conent":[{"content":"aaa","type":"string"},{"content":"bb","type":"string"},{"content":"cc","type":"string"}],"type":"array"}
```
## Slightly modified reborn functions
---

Expand Down

0 comments on commit 5f3bf91

Please sign in to comment.