Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getjson1() {
- return {
- 'json1': {
- id: 'jsonid1'
- }
- };
- }
- function getjson2() {
- return {
- 'json2': {
- id: 'jsonid2'
- }
- };
- }
- myjson = [];
- myjson.push(getjson1());
- myjson.push(getjson2());
- function finaljson() {
- return {
- 'json': myjson
- };
- }
- console.log(JSON.stringify(finaljson()));
- {"json":[{"json1":{"id":"jsonid1"}},{"json2":{"id":"jsonid2"}}]}
- {"json":{"json1":{"id":"jsonid1"},"json2":{"id":"jsonid2"}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement