Files
vgstation13/code/modules/nano/_JSON.dm
Paul Ritter 9e371f3884 starting the crusade against relative pathing (#22593)
* starting the crusade against relative pathing

* new() part1

* new() part 2

* FOR VALHALLA

* you sneaky buggers

* part 5: the reckoning

* chapter 6: rejuvination

* chapter 7: age of conflict

* dammit travis
2019-04-29 13:33:46 -03:00

22 lines
527 B
Plaintext

/*
n_Json v11.3.21
*/
proc/json2list(json)
var/static/json_reader/_jsonr = new()
// N3X: Array support.
if(dd_hasprefix(json,"\["))
return _jsonr.ReadArray(_jsonr.ScanJson(json))
else
return _jsonr.ReadObject(_jsonr.ScanJson(json))
proc/list2json(list/L)
var/static/json_writer/_jsonw = new()
// Detect if it's just a list of things, or an associative list
// (Used to just assume associative, which broke things.)
if(_jsonw.is_associative(L))
return _jsonw.WriteObject(L)
else
return _jsonw.write_array(L)