Last active
December 16, 2015 22:59
-
-
Save gogromat/5511165 to your computer and use it in GitHub Desktop.
This file contains 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
Jason("sample", sample_data).sample.flatten().getJsonData(); |
This file contains 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
// Default flattener behavior: | |
// Flattens both nested arrays and objects, | |
// uses . for array keys and object properties | |
[ | |
{ | |
"name": "Alexander", | |
"nickname": "GogromaT", | |
"studies.0": "Com Sci", | |
"studies.1": "Japanese", | |
"studies.2": "Photography", | |
"body.gender": "Male", | |
"body.height": "6.4\"", | |
"body.eyes": "Blue" | |
}, | |
{ | |
"name": "Constantine", | |
"nickname": "KA", | |
"likes.0": "TED Talks", | |
"likes.1": "Beer", | |
"likes.2": "Movies", | |
"likes.3": "Cars", | |
"owns.0.name": "car", | |
"owns.0.model": "Dodge Intrepid", | |
"owns.0.model_year": 2004, | |
"owns.1.name": "camera", | |
"owns.1.model": "Pentax X-5" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment