need some tips on how to do this correctly recursively.
Basically, what I'm doing is going into a bunch of text, and it returns it as JSON.
For example:
Text:
q b name:rawr
Return:
[ "q", "b", { "name": "rawr" } ]
And the following input:
q b name:rawr:awesome
Will return (output format is not important):
[ "q", "b", { "name": { "rawr": "awesome" } } ]
How can I modify the following code to allow a recursive way to have objects in objects.
var jsonify = function(input){ var listItems = input, myArray = [], end = [], i, item; var items = listItems.split('\r\n');
javascript
Menztrual
source share