Mercurial > prosody-hg
comparison util/json.lua @ 5395:ec33d72a08b6
util.json: Add json.encode_array() (thanks B)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 28 Mar 2013 09:31:07 -0400 |
| parents | b08a46cf06e6 |
| children | a4ba5819bf50 |
comparison
equal
deleted
inserted
replaced
| 5393:57c4964eff0b | 5395:ec33d72a08b6 |
|---|---|
| 144 return t_concat(t); | 144 return t_concat(t); |
| 145 end | 145 end |
| 146 function json.encode_ordered(obj) | 146 function json.encode_ordered(obj) |
| 147 local t = { ordered = true }; | 147 local t = { ordered = true }; |
| 148 simplesave(obj, t); | 148 simplesave(obj, t); |
| 149 return t_concat(t); | |
| 150 end | |
| 151 function json.encode_array(obj) | |
| 152 local t = {}; | |
| 153 arraysave(obj, t); | |
| 149 return t_concat(t); | 154 return t_concat(t); |
| 150 end | 155 end |
| 151 | 156 |
| 152 ----------------------------------- | 157 ----------------------------------- |
| 153 | 158 |
