Created
July 17, 2015 18:18
-
-
Save PlaidShirtPat/3dcacf60bcfa8bc81be6 to your computer and use it in GitHub Desktop.
How to generate JSON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function generateEveryValidAttributeName(); | |
| function toJSONObject(item){ | |
| var jsonString = "{"; | |
| var everyAttribute = | |
| for(i=0; i<generateEveryValidAttributeName(); i++){ | |
| if(item.hasOwnProperty(generateEveryValidAttributeName()[i]){ | |
| jsonString = jsonString + | |
| '"' + generateEveryValidAttributeName()[i] + '": ' + | |
| item[generateEveryValidAttributeName()[i]].to_json() + ','; | |
| } | |
| } | |
| return jsonString + "}"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment