[FREQ] json.toVars json.fromVars

If you have an idea for a new feature, please discuss it in the main MapTool forum first, then post a summary of the discussion here. Use the first Sticky as a template.

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

[FREQ] json.toVars json.fromVars

Post by aliasmask »

I made a similar request to the MOTE team since they're getting rid of the string prop functions. Could be nice to have it here too.

Code: Select all

json.toVars(jsonObj[,prefix]): jsonArray of keys
json.fromVars(jsonArray/List[,prefix]): jsonObj

The prefix is optional. json.toVars adds the prefix to the key values in json object. Error is returned if prefix+key is not a valid variable format. The returned jsonArray is the list of keys of the object + the prefix if included.

json.fromVar takes an array of keys (like the one returned by json.toVars) or a string list. The prefix is optional and removes the matching prefix from the keys in the jsonArray or list. This returns a json object of the variables as keys with their values.


Post Reply

Return to “Feature Requests”