I need this json data in the below format using JSONATASerializing to JSON in jQueryHow do I format a Microsoft JSON date?Can comments be used in JSON?How can I pretty-print JSON in a shell script?What is the correct JSON content type?Why does Google prepend while(1); to their JSON responses?Why can't Python parse this JSON data?Jackson with JSON: Unrecognized field, not marked as ignorableHow do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?The “right” JSON date format

How can electricity be positive when electrons are negative?

Why is Western European music harmonically driven?

How do we create our own symbolisms?

How should Thaumaturgy's "three times as loud as normal" be interpreted?

Compiler optimization of bitwise not operation

What can we do about our 9-month-old putting fingers down his throat?

How strong is aircraft-grade spruce?

Project Euler problem #112

Is this ram compatible with iMac 27"?

What is the delta-v required to get a mass in Earth orbit into the sun using a SINGLE transfer?

Is it right to use the ideas of non-winning designers in a design contest?

Protecting programs on external drives with the same priviledges as in Program Files

Supervisor wants me to support a diploma-thesis SW tool after I graduated

How to plot two curves with the same area under?

Friend is very nitpicky about side comments I don't intend to be taken too seriously

Why are UK MPs allowed to abstain (but it counts as a no)?

Dragons and gems

Do you need to burn fuel between gravity assists?

How do draw effects during the discard phase work?

Is there some sort of French saying for "a person's signature move"?

Short story: Interstellar inspector senses "off" nature of planet hiding aggressive culture

What is the highest velocity a spacecraft has left Earth?

Word for something that used to be popular but not anymore

What's the biggest difference between these two photos?



I need this json data in the below format using JSONATA


Serializing to JSON in jQueryHow do I format a Microsoft JSON date?Can comments be used in JSON?How can I pretty-print JSON in a shell script?What is the correct JSON content type?Why does Google prepend while(1); to their JSON responses?Why can't Python parse this JSON data?Jackson with JSON: Unrecognized field, not marked as ignorableHow do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?The “right” JSON date format






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Below json is my input.




"payload":
"KA01B3432": "KA01B3432",
"KA02A3123": "KA02A3123"




Using JSONATA i need to format the above JSON to below format.



[

"KA01B3432": "KA01B3432"
,

"KA02A3123": "KA02A3123"

]


I tried payload.[$keys()] but this will yield only keys in array format not whole object in array format.




"payload":
"KA01B3432": "KA01B3432",
"KA02A3123": "KA02A3123"




to



[

"KA01B3432": "KA01B3432"
,

"KA02A3123": "KA02A3123"

]









share|improve this question
































    0















    Below json is my input.




    "payload":
    "KA01B3432": "KA01B3432",
    "KA02A3123": "KA02A3123"




    Using JSONATA i need to format the above JSON to below format.



    [

    "KA01B3432": "KA01B3432"
    ,

    "KA02A3123": "KA02A3123"

    ]


    I tried payload.[$keys()] but this will yield only keys in array format not whole object in array format.




    "payload":
    "KA01B3432": "KA01B3432",
    "KA02A3123": "KA02A3123"




    to



    [

    "KA01B3432": "KA01B3432"
    ,

    "KA02A3123": "KA02A3123"

    ]









    share|improve this question




























      0












      0








      0








      Below json is my input.




      "payload":
      "KA01B3432": "KA01B3432",
      "KA02A3123": "KA02A3123"




      Using JSONATA i need to format the above JSON to below format.



      [

      "KA01B3432": "KA01B3432"
      ,

      "KA02A3123": "KA02A3123"

      ]


      I tried payload.[$keys()] but this will yield only keys in array format not whole object in array format.




      "payload":
      "KA01B3432": "KA01B3432",
      "KA02A3123": "KA02A3123"




      to



      [

      "KA01B3432": "KA01B3432"
      ,

      "KA02A3123": "KA02A3123"

      ]









      share|improve this question
















      Below json is my input.




      "payload":
      "KA01B3432": "KA01B3432",
      "KA02A3123": "KA02A3123"




      Using JSONATA i need to format the above JSON to below format.



      [

      "KA01B3432": "KA01B3432"
      ,

      "KA02A3123": "KA02A3123"

      ]


      I tried payload.[$keys()] but this will yield only keys in array format not whole object in array format.




      "payload":
      "KA01B3432": "KA01B3432",
      "KA02A3123": "KA02A3123"




      to



      [

      "KA01B3432": "KA01B3432"
      ,

      "KA02A3123": "KA02A3123"

      ]






      json jsonata






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 9:14









      Mebin Joe

      1,2161 gold badge11 silver badges20 bronze badges




      1,2161 gold badge11 silver badges20 bronze badges










      asked Mar 28 at 6:26









      sachin chaurasiasachin chaurasia

      31 bronze badge




      31 bronze badge

























          2 Answers
          2






          active

          oldest

          votes


















          0
















          $spread(payload) does what you need.



          See http://try.jsonata.org/S1COdDqO4






          share|improve this answer

























          • Thank you so much for your solution :)

            – sachin chaurasia
            Apr 25 at 6:50


















          0
















          What about the following code :



           var json = "payload": "KA01B3432": "KA01B34321", "KA02A3123": "KA02A31231" ;
          var array = [];
          keys = Object.keys(json.payload);
          values = Object.values(json.payload);
          for (var i = 0; i < keys.length; i++)
          var item = ;
          item[keys[i]] = values[i];

          array.push(item);

          console.log(array);





          share|improve this answer



























          • I used the same code but still it is not providing the expected result.

            – sachin chaurasia
            Mar 28 at 8:20











          • [ key: 'KA01B3432', value: 'KA01B34321' , key: 'KA02A3123', value: 'KA02A31231' ] This is what I recieved by running your code, but in the expected result there is no "Key" and "Value" words.

            – sachin chaurasia
            Mar 28 at 8:22











          • use this please item[keys[i]] = values[i]; i'm going to update the answer and this will provide exactly what you need

            – Mahmoud-Abdelslam
            Mar 28 at 8:25












          • Now it is working as expected, Thank you :)

            – sachin chaurasia
            Apr 25 at 6:53













          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391350%2fi-need-this-json-data-in-the-below-format-using-jsonata%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0
















          $spread(payload) does what you need.



          See http://try.jsonata.org/S1COdDqO4






          share|improve this answer

























          • Thank you so much for your solution :)

            – sachin chaurasia
            Apr 25 at 6:50















          0
















          $spread(payload) does what you need.



          See http://try.jsonata.org/S1COdDqO4






          share|improve this answer

























          • Thank you so much for your solution :)

            – sachin chaurasia
            Apr 25 at 6:50













          0














          0










          0









          $spread(payload) does what you need.



          See http://try.jsonata.org/S1COdDqO4






          share|improve this answer













          $spread(payload) does what you need.



          See http://try.jsonata.org/S1COdDqO4







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 15:31









          Andrew ColemanAndrew Coleman

          3811 silver badge4 bronze badges




          3811 silver badge4 bronze badges















          • Thank you so much for your solution :)

            – sachin chaurasia
            Apr 25 at 6:50

















          • Thank you so much for your solution :)

            – sachin chaurasia
            Apr 25 at 6:50
















          Thank you so much for your solution :)

          – sachin chaurasia
          Apr 25 at 6:50





          Thank you so much for your solution :)

          – sachin chaurasia
          Apr 25 at 6:50













          0
















          What about the following code :



           var json = "payload": "KA01B3432": "KA01B34321", "KA02A3123": "KA02A31231" ;
          var array = [];
          keys = Object.keys(json.payload);
          values = Object.values(json.payload);
          for (var i = 0; i < keys.length; i++)
          var item = ;
          item[keys[i]] = values[i];

          array.push(item);

          console.log(array);





          share|improve this answer



























          • I used the same code but still it is not providing the expected result.

            – sachin chaurasia
            Mar 28 at 8:20











          • [ key: 'KA01B3432', value: 'KA01B34321' , key: 'KA02A3123', value: 'KA02A31231' ] This is what I recieved by running your code, but in the expected result there is no "Key" and "Value" words.

            – sachin chaurasia
            Mar 28 at 8:22











          • use this please item[keys[i]] = values[i]; i'm going to update the answer and this will provide exactly what you need

            – Mahmoud-Abdelslam
            Mar 28 at 8:25












          • Now it is working as expected, Thank you :)

            – sachin chaurasia
            Apr 25 at 6:53















          0
















          What about the following code :



           var json = "payload": "KA01B3432": "KA01B34321", "KA02A3123": "KA02A31231" ;
          var array = [];
          keys = Object.keys(json.payload);
          values = Object.values(json.payload);
          for (var i = 0; i < keys.length; i++)
          var item = ;
          item[keys[i]] = values[i];

          array.push(item);

          console.log(array);





          share|improve this answer



























          • I used the same code but still it is not providing the expected result.

            – sachin chaurasia
            Mar 28 at 8:20











          • [ key: 'KA01B3432', value: 'KA01B34321' , key: 'KA02A3123', value: 'KA02A31231' ] This is what I recieved by running your code, but in the expected result there is no "Key" and "Value" words.

            – sachin chaurasia
            Mar 28 at 8:22











          • use this please item[keys[i]] = values[i]; i'm going to update the answer and this will provide exactly what you need

            – Mahmoud-Abdelslam
            Mar 28 at 8:25












          • Now it is working as expected, Thank you :)

            – sachin chaurasia
            Apr 25 at 6:53













          0














          0










          0









          What about the following code :



           var json = "payload": "KA01B3432": "KA01B34321", "KA02A3123": "KA02A31231" ;
          var array = [];
          keys = Object.keys(json.payload);
          values = Object.values(json.payload);
          for (var i = 0; i < keys.length; i++)
          var item = ;
          item[keys[i]] = values[i];

          array.push(item);

          console.log(array);





          share|improve this answer















          What about the following code :



           var json = "payload": "KA01B3432": "KA01B34321", "KA02A3123": "KA02A31231" ;
          var array = [];
          keys = Object.keys(json.payload);
          values = Object.values(json.payload);
          for (var i = 0; i < keys.length; i++)
          var item = ;
          item[keys[i]] = values[i];

          array.push(item);

          console.log(array);






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 28 at 8:26

























          answered Mar 28 at 7:18









          Mahmoud-AbdelslamMahmoud-Abdelslam

          1591 silver badge7 bronze badges




          1591 silver badge7 bronze badges















          • I used the same code but still it is not providing the expected result.

            – sachin chaurasia
            Mar 28 at 8:20











          • [ key: 'KA01B3432', value: 'KA01B34321' , key: 'KA02A3123', value: 'KA02A31231' ] This is what I recieved by running your code, but in the expected result there is no "Key" and "Value" words.

            – sachin chaurasia
            Mar 28 at 8:22











          • use this please item[keys[i]] = values[i]; i'm going to update the answer and this will provide exactly what you need

            – Mahmoud-Abdelslam
            Mar 28 at 8:25












          • Now it is working as expected, Thank you :)

            – sachin chaurasia
            Apr 25 at 6:53

















          • I used the same code but still it is not providing the expected result.

            – sachin chaurasia
            Mar 28 at 8:20











          • [ key: 'KA01B3432', value: 'KA01B34321' , key: 'KA02A3123', value: 'KA02A31231' ] This is what I recieved by running your code, but in the expected result there is no "Key" and "Value" words.

            – sachin chaurasia
            Mar 28 at 8:22











          • use this please item[keys[i]] = values[i]; i'm going to update the answer and this will provide exactly what you need

            – Mahmoud-Abdelslam
            Mar 28 at 8:25












          • Now it is working as expected, Thank you :)

            – sachin chaurasia
            Apr 25 at 6:53
















          I used the same code but still it is not providing the expected result.

          – sachin chaurasia
          Mar 28 at 8:20





          I used the same code but still it is not providing the expected result.

          – sachin chaurasia
          Mar 28 at 8:20













          [ key: 'KA01B3432', value: 'KA01B34321' , key: 'KA02A3123', value: 'KA02A31231' ] This is what I recieved by running your code, but in the expected result there is no "Key" and "Value" words.

          – sachin chaurasia
          Mar 28 at 8:22





          [ key: 'KA01B3432', value: 'KA01B34321' , key: 'KA02A3123', value: 'KA02A31231' ] This is what I recieved by running your code, but in the expected result there is no "Key" and "Value" words.

          – sachin chaurasia
          Mar 28 at 8:22













          use this please item[keys[i]] = values[i]; i'm going to update the answer and this will provide exactly what you need

          – Mahmoud-Abdelslam
          Mar 28 at 8:25






          use this please item[keys[i]] = values[i]; i'm going to update the answer and this will provide exactly what you need

          – Mahmoud-Abdelslam
          Mar 28 at 8:25














          Now it is working as expected, Thank you :)

          – sachin chaurasia
          Apr 25 at 6:53





          Now it is working as expected, Thank you :)

          – sachin chaurasia
          Apr 25 at 6:53


















          draft saved

          draft discarded















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391350%2fi-need-this-json-data-in-the-below-format-using-jsonata%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript