Get element from json array javascript [closed]How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?Can comments be used in JSON?How can I convert a string to boolean in JavaScript?What is the correct JSON content type?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?

Does ultrasonic bath cleaning damage laboratory volumetric glassware calibration?

What determines the "strength of impact" of a falling object on the ground, momentum or energy?

"It will become the talk of Paris" - translation into French

Is it possible to buy a train ticket CDG airport to Paris truly online?

What is this particular type of chord progression, common in classical music, called?

Why would people reject a god's purely beneficial blessing?

Do French speakers not use the subjunctive informally?

How should I behave to assure my friends that I am not after their money?

Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?

Should I tell my insurance company I'm making payments on my new car?

Every infinite linearly ordered set has two disjoint infinite subsets

MH370 blackbox - is it still possible to retrieve data from it?

Why does the A-4 Skyhawk sit nose-up when on ground?

Symbolic equivalent of chmod 400

Why does Darth Sidious need bodyguards?

Are Finite Automata Turing Complete?

Alphabet completion rate

Averting Real Women Don’t Wear Dresses

In the Marvel universe, can a human have a baby with any non-human?

Mount a folder with a space on Linux

Inverse-quotes-quine

What is the line crossing the Pacific Ocean that is shown on maps?

Should my manager be aware of private LinkedIn approaches I receive? How to politely have this happen?

How well known and how commonly used was Huffman coding in 1979?



Get element from json array javascript [closed]


How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?Can comments be used in JSON?How can I convert a string to boolean in JavaScript?What is the correct JSON content type?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?






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








4















I have a simple Json String



[

"assetName":"LCT",
"assetValue":"",
"typeValueInput":"select",
"valueInputSelect":null,
"required":true,
"valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

]


I want get field Name in Data in ValueInput by Javascript.



Please help me!










share|improve this question















closed as off-topic by CertainPerformance, pirho, wscourge, Kristopher Ives, Bart Mar 25 at 17:23


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible Example." – pirho, wscourge, Kristopher Ives, Bart
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1





    You can use JSON.parse to convert json to object.

    – Eddie
    Mar 25 at 8:44






  • 2





    Why does this have seven upvotes? It does not show any effort made by the OP. What did they try? What did not work? stackoverflow.com/help/how-to-ask

    – Denny
    Mar 25 at 11:18


















4















I have a simple Json String



[

"assetName":"LCT",
"assetValue":"",
"typeValueInput":"select",
"valueInputSelect":null,
"required":true,
"valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

]


I want get field Name in Data in ValueInput by Javascript.



Please help me!










share|improve this question















closed as off-topic by CertainPerformance, pirho, wscourge, Kristopher Ives, Bart Mar 25 at 17:23


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible Example." – pirho, wscourge, Kristopher Ives, Bart
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1





    You can use JSON.parse to convert json to object.

    – Eddie
    Mar 25 at 8:44






  • 2





    Why does this have seven upvotes? It does not show any effort made by the OP. What did they try? What did not work? stackoverflow.com/help/how-to-ask

    – Denny
    Mar 25 at 11:18














4












4








4








I have a simple Json String



[

"assetName":"LCT",
"assetValue":"",
"typeValueInput":"select",
"valueInputSelect":null,
"required":true,
"valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

]


I want get field Name in Data in ValueInput by Javascript.



Please help me!










share|improve this question
















I have a simple Json String



[

"assetName":"LCT",
"assetValue":"",
"typeValueInput":"select",
"valueInputSelect":null,
"required":true,
"valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

]


I want get field Name in Data in ValueInput by Javascript.



Please help me!







javascript arrays json object






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 8:49









Jack Bashford

26.7k6 gold badges24 silver badges51 bronze badges




26.7k6 gold badges24 silver badges51 bronze badges










asked Mar 25 at 8:42









Java Dev BeginnerJava Dev Beginner

601 silver badge8 bronze badges




601 silver badge8 bronze badges




closed as off-topic by CertainPerformance, pirho, wscourge, Kristopher Ives, Bart Mar 25 at 17:23


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible Example." – pirho, wscourge, Kristopher Ives, Bart
If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by CertainPerformance, pirho, wscourge, Kristopher Ives, Bart Mar 25 at 17:23


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible Example." – pirho, wscourge, Kristopher Ives, Bart
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 1





    You can use JSON.parse to convert json to object.

    – Eddie
    Mar 25 at 8:44






  • 2





    Why does this have seven upvotes? It does not show any effort made by the OP. What did they try? What did not work? stackoverflow.com/help/how-to-ask

    – Denny
    Mar 25 at 11:18













  • 1





    You can use JSON.parse to convert json to object.

    – Eddie
    Mar 25 at 8:44






  • 2





    Why does this have seven upvotes? It does not show any effort made by the OP. What did they try? What did not work? stackoverflow.com/help/how-to-ask

    – Denny
    Mar 25 at 11:18








1




1





You can use JSON.parse to convert json to object.

– Eddie
Mar 25 at 8:44





You can use JSON.parse to convert json to object.

– Eddie
Mar 25 at 8:44




2




2





Why does this have seven upvotes? It does not show any effort made by the OP. What did they try? What did not work? stackoverflow.com/help/how-to-ask

– Denny
Mar 25 at 11:18






Why does this have seven upvotes? It does not show any effort made by the OP. What did they try? What did not work? stackoverflow.com/help/how-to-ask

– Denny
Mar 25 at 11:18













7 Answers
7






active

oldest

votes


















4














You need to loop through the array and then parse the stringified JSON so that you can access the data array. Then simply loop that data array to get the value of each name property.






var arr = [
"assetName": "LCT",
"assetValue": "",
"typeValueInput": "select",
"valueInputSelect": null,
"required": true,
"valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
];

arr.forEach((arrObj) =>
var jsonData = JSON.parse(arrObj.valueInput);
jsonData.data.forEach((name) => console.log(name));
);








share|improve this answer






























    1














    You could use JSON.parse




    var jsonArray = [

    assetName: 'LCT',
    assetValue: '',
    typeValueInput: 'select',
    valueInputSelect: null,
    required: true,
    valueInput:
    '"data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]'

    ];

    let name = jsonArray[0].valueInput;
    name = JSON.parse(name);
    name.data.forEach(value =>
    console.log(value.name, value.id);
    );








    share|improve this answer






























      0














      You can use JSON.parse



      JSON.parse(o[0].valueInput).data[0].name





      var o = [

      "assetName":"LCT",
      "assetValue":"",
      "typeValueInput":"select",
      "valueInputSelect":null,
      "required":true,
      "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

      ]

      console.log(JSON.parse(o[0].valueInput).data[0].name);

      // To get all, use a loop

      var arrO = JSON.parse(o[0].valueInput).data;

      arrO.forEach((obj) => console.log(obj.name))








      share|improve this answer























      • @Deepakgupta data[0] is not a string, the array is parsed before. See the live demo before post a comment

        – R3tep
        Mar 25 at 8:51











      • the input value is a string, not an object, and the string is not correctly stringified.

        – AZ_
        Mar 25 at 9:03











      • @AZ_ The input value is not a string. Jack make some bad edit

        – R3tep
        Mar 25 at 9:07






      • 1





        it says I have a simple Json String not sure maybe.

        – AZ_
        Mar 25 at 9:15











      • @AZ_ Yes he have a json string into the key valueInput

        – R3tep
        Mar 25 at 9:16


















      0














      Use JSON.parse, and use map:






      const data = [
      "assetName": "LCT",
      "assetValue": "",
      "typeValueInput": "select",
      "valueInputSelect": null,
      "required": true,
      "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
      ]
      const names = JSON.parse(data[0].valueInput).data.map(( name ) => name);
      console.log(names);








      share|improve this answer






























        0














        You can use an array variable and the callback function of JSON.parse to get the name key & val






        let dt = [
        "assetName": "LCT",
        "assetValue": "",
        "typeValueInput": "select",
        "valueInputSelect": null,
        "required": true,
        "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
        ];
        let nameArray = [];

        let dlt = JSON.parse(dt[0].valueInput, function(key, val)
        if (key === 'name')
        nameArray.push(val);

        )

        console.log(nameArray)








        share|improve this answer






























          0














          Here is a way to do it.



          let originalData = [

          "assetName":"LCT",
          "assetValue":"",
          "typeValueInput":"select",
          "valueInputSelect":null,
          "required":true,
          "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

          ];

          let valueInput = JSON.parse(originalData[0].valueInput);

          let data = valueInput.data;

          console.log(data);

          for (var i = 0; i < data.length; i++)
          console.log(data[i].name);



          See jsfiddle https://jsfiddle.net/3s1na4eL/3/



          Let me know if there are any questions.






          share|improve this answer






























            0














            You can do:






            const arr = ["assetName": "LCT","assetValue": "","typeValueInput": "select","valueInputSelect": null,"required": true,"valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"];

            arr.forEach(o => JSON.parse(o.valueInput).data.forEach((id, name) => console.log(id, name)));








            share|improve this answer

































              7 Answers
              7






              active

              oldest

              votes








              7 Answers
              7






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              4














              You need to loop through the array and then parse the stringified JSON so that you can access the data array. Then simply loop that data array to get the value of each name property.






              var arr = [
              "assetName": "LCT",
              "assetValue": "",
              "typeValueInput": "select",
              "valueInputSelect": null,
              "required": true,
              "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
              ];

              arr.forEach((arrObj) =>
              var jsonData = JSON.parse(arrObj.valueInput);
              jsonData.data.forEach((name) => console.log(name));
              );








              share|improve this answer



























                4














                You need to loop through the array and then parse the stringified JSON so that you can access the data array. Then simply loop that data array to get the value of each name property.






                var arr = [
                "assetName": "LCT",
                "assetValue": "",
                "typeValueInput": "select",
                "valueInputSelect": null,
                "required": true,
                "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                ];

                arr.forEach((arrObj) =>
                var jsonData = JSON.parse(arrObj.valueInput);
                jsonData.data.forEach((name) => console.log(name));
                );








                share|improve this answer

























                  4












                  4








                  4







                  You need to loop through the array and then parse the stringified JSON so that you can access the data array. Then simply loop that data array to get the value of each name property.






                  var arr = [
                  "assetName": "LCT",
                  "assetValue": "",
                  "typeValueInput": "select",
                  "valueInputSelect": null,
                  "required": true,
                  "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                  ];

                  arr.forEach((arrObj) =>
                  var jsonData = JSON.parse(arrObj.valueInput);
                  jsonData.data.forEach((name) => console.log(name));
                  );








                  share|improve this answer













                  You need to loop through the array and then parse the stringified JSON so that you can access the data array. Then simply loop that data array to get the value of each name property.






                  var arr = [
                  "assetName": "LCT",
                  "assetValue": "",
                  "typeValueInput": "select",
                  "valueInputSelect": null,
                  "required": true,
                  "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                  ];

                  arr.forEach((arrObj) =>
                  var jsonData = JSON.parse(arrObj.valueInput);
                  jsonData.data.forEach((name) => console.log(name));
                  );








                  var arr = [
                  "assetName": "LCT",
                  "assetValue": "",
                  "typeValueInput": "select",
                  "valueInputSelect": null,
                  "required": true,
                  "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                  ];

                  arr.forEach((arrObj) =>
                  var jsonData = JSON.parse(arrObj.valueInput);
                  jsonData.data.forEach((name) => console.log(name));
                  );





                  var arr = [
                  "assetName": "LCT",
                  "assetValue": "",
                  "typeValueInput": "select",
                  "valueInputSelect": null,
                  "required": true,
                  "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                  ];

                  arr.forEach((arrObj) =>
                  var jsonData = JSON.parse(arrObj.valueInput);
                  jsonData.data.forEach((name) => console.log(name));
                  );






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 25 at 8:45









                  Ankit AgarwalAnkit Agarwal

                  25k5 gold badges23 silver badges45 bronze badges




                  25k5 gold badges23 silver badges45 bronze badges























                      1














                      You could use JSON.parse




                      var jsonArray = [

                      assetName: 'LCT',
                      assetValue: '',
                      typeValueInput: 'select',
                      valueInputSelect: null,
                      required: true,
                      valueInput:
                      '"data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]'

                      ];

                      let name = jsonArray[0].valueInput;
                      name = JSON.parse(name);
                      name.data.forEach(value =>
                      console.log(value.name, value.id);
                      );








                      share|improve this answer



























                        1














                        You could use JSON.parse




                        var jsonArray = [

                        assetName: 'LCT',
                        assetValue: '',
                        typeValueInput: 'select',
                        valueInputSelect: null,
                        required: true,
                        valueInput:
                        '"data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]'

                        ];

                        let name = jsonArray[0].valueInput;
                        name = JSON.parse(name);
                        name.data.forEach(value =>
                        console.log(value.name, value.id);
                        );








                        share|improve this answer

























                          1












                          1








                          1







                          You could use JSON.parse




                          var jsonArray = [

                          assetName: 'LCT',
                          assetValue: '',
                          typeValueInput: 'select',
                          valueInputSelect: null,
                          required: true,
                          valueInput:
                          '"data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]'

                          ];

                          let name = jsonArray[0].valueInput;
                          name = JSON.parse(name);
                          name.data.forEach(value =>
                          console.log(value.name, value.id);
                          );








                          share|improve this answer













                          You could use JSON.parse




                          var jsonArray = [

                          assetName: 'LCT',
                          assetValue: '',
                          typeValueInput: 'select',
                          valueInputSelect: null,
                          required: true,
                          valueInput:
                          '"data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]'

                          ];

                          let name = jsonArray[0].valueInput;
                          name = JSON.parse(name);
                          name.data.forEach(value =>
                          console.log(value.name, value.id);
                          );








                          var jsonArray = [

                          assetName: 'LCT',
                          assetValue: '',
                          typeValueInput: 'select',
                          valueInputSelect: null,
                          required: true,
                          valueInput:
                          '"data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]'

                          ];

                          let name = jsonArray[0].valueInput;
                          name = JSON.parse(name);
                          name.data.forEach(value =>
                          console.log(value.name, value.id);
                          );





                          var jsonArray = [

                          assetName: 'LCT',
                          assetValue: '',
                          typeValueInput: 'select',
                          valueInputSelect: null,
                          required: true,
                          valueInput:
                          '"data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]'

                          ];

                          let name = jsonArray[0].valueInput;
                          name = JSON.parse(name);
                          name.data.forEach(value =>
                          console.log(value.name, value.id);
                          );






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 25 at 8:47









                          Loc MaiLoc Mai

                          411 silver badge3 bronze badges




                          411 silver badge3 bronze badges





















                              0














                              You can use JSON.parse



                              JSON.parse(o[0].valueInput).data[0].name





                              var o = [

                              "assetName":"LCT",
                              "assetValue":"",
                              "typeValueInput":"select",
                              "valueInputSelect":null,
                              "required":true,
                              "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                              ]

                              console.log(JSON.parse(o[0].valueInput).data[0].name);

                              // To get all, use a loop

                              var arrO = JSON.parse(o[0].valueInput).data;

                              arrO.forEach((obj) => console.log(obj.name))








                              share|improve this answer























                              • @Deepakgupta data[0] is not a string, the array is parsed before. See the live demo before post a comment

                                – R3tep
                                Mar 25 at 8:51











                              • the input value is a string, not an object, and the string is not correctly stringified.

                                – AZ_
                                Mar 25 at 9:03











                              • @AZ_ The input value is not a string. Jack make some bad edit

                                – R3tep
                                Mar 25 at 9:07






                              • 1





                                it says I have a simple Json String not sure maybe.

                                – AZ_
                                Mar 25 at 9:15











                              • @AZ_ Yes he have a json string into the key valueInput

                                – R3tep
                                Mar 25 at 9:16















                              0














                              You can use JSON.parse



                              JSON.parse(o[0].valueInput).data[0].name





                              var o = [

                              "assetName":"LCT",
                              "assetValue":"",
                              "typeValueInput":"select",
                              "valueInputSelect":null,
                              "required":true,
                              "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                              ]

                              console.log(JSON.parse(o[0].valueInput).data[0].name);

                              // To get all, use a loop

                              var arrO = JSON.parse(o[0].valueInput).data;

                              arrO.forEach((obj) => console.log(obj.name))








                              share|improve this answer























                              • @Deepakgupta data[0] is not a string, the array is parsed before. See the live demo before post a comment

                                – R3tep
                                Mar 25 at 8:51











                              • the input value is a string, not an object, and the string is not correctly stringified.

                                – AZ_
                                Mar 25 at 9:03











                              • @AZ_ The input value is not a string. Jack make some bad edit

                                – R3tep
                                Mar 25 at 9:07






                              • 1





                                it says I have a simple Json String not sure maybe.

                                – AZ_
                                Mar 25 at 9:15











                              • @AZ_ Yes he have a json string into the key valueInput

                                – R3tep
                                Mar 25 at 9:16













                              0












                              0








                              0







                              You can use JSON.parse



                              JSON.parse(o[0].valueInput).data[0].name





                              var o = [

                              "assetName":"LCT",
                              "assetValue":"",
                              "typeValueInput":"select",
                              "valueInputSelect":null,
                              "required":true,
                              "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                              ]

                              console.log(JSON.parse(o[0].valueInput).data[0].name);

                              // To get all, use a loop

                              var arrO = JSON.parse(o[0].valueInput).data;

                              arrO.forEach((obj) => console.log(obj.name))








                              share|improve this answer













                              You can use JSON.parse



                              JSON.parse(o[0].valueInput).data[0].name





                              var o = [

                              "assetName":"LCT",
                              "assetValue":"",
                              "typeValueInput":"select",
                              "valueInputSelect":null,
                              "required":true,
                              "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                              ]

                              console.log(JSON.parse(o[0].valueInput).data[0].name);

                              // To get all, use a loop

                              var arrO = JSON.parse(o[0].valueInput).data;

                              arrO.forEach((obj) => console.log(obj.name))








                              var o = [

                              "assetName":"LCT",
                              "assetValue":"",
                              "typeValueInput":"select",
                              "valueInputSelect":null,
                              "required":true,
                              "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                              ]

                              console.log(JSON.parse(o[0].valueInput).data[0].name);

                              // To get all, use a loop

                              var arrO = JSON.parse(o[0].valueInput).data;

                              arrO.forEach((obj) => console.log(obj.name))





                              var o = [

                              "assetName":"LCT",
                              "assetValue":"",
                              "typeValueInput":"select",
                              "valueInputSelect":null,
                              "required":true,
                              "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                              ]

                              console.log(JSON.parse(o[0].valueInput).data[0].name);

                              // To get all, use a loop

                              var arrO = JSON.parse(o[0].valueInput).data;

                              arrO.forEach((obj) => console.log(obj.name))






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Mar 25 at 8:44









                              R3tepR3tep

                              8,7528 gold badges29 silver badges64 bronze badges




                              8,7528 gold badges29 silver badges64 bronze badges












                              • @Deepakgupta data[0] is not a string, the array is parsed before. See the live demo before post a comment

                                – R3tep
                                Mar 25 at 8:51











                              • the input value is a string, not an object, and the string is not correctly stringified.

                                – AZ_
                                Mar 25 at 9:03











                              • @AZ_ The input value is not a string. Jack make some bad edit

                                – R3tep
                                Mar 25 at 9:07






                              • 1





                                it says I have a simple Json String not sure maybe.

                                – AZ_
                                Mar 25 at 9:15











                              • @AZ_ Yes he have a json string into the key valueInput

                                – R3tep
                                Mar 25 at 9:16

















                              • @Deepakgupta data[0] is not a string, the array is parsed before. See the live demo before post a comment

                                – R3tep
                                Mar 25 at 8:51











                              • the input value is a string, not an object, and the string is not correctly stringified.

                                – AZ_
                                Mar 25 at 9:03











                              • @AZ_ The input value is not a string. Jack make some bad edit

                                – R3tep
                                Mar 25 at 9:07






                              • 1





                                it says I have a simple Json String not sure maybe.

                                – AZ_
                                Mar 25 at 9:15











                              • @AZ_ Yes he have a json string into the key valueInput

                                – R3tep
                                Mar 25 at 9:16
















                              @Deepakgupta data[0] is not a string, the array is parsed before. See the live demo before post a comment

                              – R3tep
                              Mar 25 at 8:51





                              @Deepakgupta data[0] is not a string, the array is parsed before. See the live demo before post a comment

                              – R3tep
                              Mar 25 at 8:51













                              the input value is a string, not an object, and the string is not correctly stringified.

                              – AZ_
                              Mar 25 at 9:03





                              the input value is a string, not an object, and the string is not correctly stringified.

                              – AZ_
                              Mar 25 at 9:03













                              @AZ_ The input value is not a string. Jack make some bad edit

                              – R3tep
                              Mar 25 at 9:07





                              @AZ_ The input value is not a string. Jack make some bad edit

                              – R3tep
                              Mar 25 at 9:07




                              1




                              1





                              it says I have a simple Json String not sure maybe.

                              – AZ_
                              Mar 25 at 9:15





                              it says I have a simple Json String not sure maybe.

                              – AZ_
                              Mar 25 at 9:15













                              @AZ_ Yes he have a json string into the key valueInput

                              – R3tep
                              Mar 25 at 9:16





                              @AZ_ Yes he have a json string into the key valueInput

                              – R3tep
                              Mar 25 at 9:16











                              0














                              Use JSON.parse, and use map:






                              const data = [
                              "assetName": "LCT",
                              "assetValue": "",
                              "typeValueInput": "select",
                              "valueInputSelect": null,
                              "required": true,
                              "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                              ]
                              const names = JSON.parse(data[0].valueInput).data.map(( name ) => name);
                              console.log(names);








                              share|improve this answer



























                                0














                                Use JSON.parse, and use map:






                                const data = [
                                "assetName": "LCT",
                                "assetValue": "",
                                "typeValueInput": "select",
                                "valueInputSelect": null,
                                "required": true,
                                "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                ]
                                const names = JSON.parse(data[0].valueInput).data.map(( name ) => name);
                                console.log(names);








                                share|improve this answer

























                                  0












                                  0








                                  0







                                  Use JSON.parse, and use map:






                                  const data = [
                                  "assetName": "LCT",
                                  "assetValue": "",
                                  "typeValueInput": "select",
                                  "valueInputSelect": null,
                                  "required": true,
                                  "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                  ]
                                  const names = JSON.parse(data[0].valueInput).data.map(( name ) => name);
                                  console.log(names);








                                  share|improve this answer













                                  Use JSON.parse, and use map:






                                  const data = [
                                  "assetName": "LCT",
                                  "assetValue": "",
                                  "typeValueInput": "select",
                                  "valueInputSelect": null,
                                  "required": true,
                                  "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                  ]
                                  const names = JSON.parse(data[0].valueInput).data.map(( name ) => name);
                                  console.log(names);








                                  const data = [
                                  "assetName": "LCT",
                                  "assetValue": "",
                                  "typeValueInput": "select",
                                  "valueInputSelect": null,
                                  "required": true,
                                  "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                  ]
                                  const names = JSON.parse(data[0].valueInput).data.map(( name ) => name);
                                  console.log(names);





                                  const data = [
                                  "assetName": "LCT",
                                  "assetValue": "",
                                  "typeValueInput": "select",
                                  "valueInputSelect": null,
                                  "required": true,
                                  "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                  ]
                                  const names = JSON.parse(data[0].valueInput).data.map(( name ) => name);
                                  console.log(names);






                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered Mar 25 at 8:51









                                  Jack BashfordJack Bashford

                                  26.7k6 gold badges24 silver badges51 bronze badges




                                  26.7k6 gold badges24 silver badges51 bronze badges





















                                      0














                                      You can use an array variable and the callback function of JSON.parse to get the name key & val






                                      let dt = [
                                      "assetName": "LCT",
                                      "assetValue": "",
                                      "typeValueInput": "select",
                                      "valueInputSelect": null,
                                      "required": true,
                                      "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                      ];
                                      let nameArray = [];

                                      let dlt = JSON.parse(dt[0].valueInput, function(key, val)
                                      if (key === 'name')
                                      nameArray.push(val);

                                      )

                                      console.log(nameArray)








                                      share|improve this answer



























                                        0














                                        You can use an array variable and the callback function of JSON.parse to get the name key & val






                                        let dt = [
                                        "assetName": "LCT",
                                        "assetValue": "",
                                        "typeValueInput": "select",
                                        "valueInputSelect": null,
                                        "required": true,
                                        "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                        ];
                                        let nameArray = [];

                                        let dlt = JSON.parse(dt[0].valueInput, function(key, val)
                                        if (key === 'name')
                                        nameArray.push(val);

                                        )

                                        console.log(nameArray)








                                        share|improve this answer

























                                          0












                                          0








                                          0







                                          You can use an array variable and the callback function of JSON.parse to get the name key & val






                                          let dt = [
                                          "assetName": "LCT",
                                          "assetValue": "",
                                          "typeValueInput": "select",
                                          "valueInputSelect": null,
                                          "required": true,
                                          "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                          ];
                                          let nameArray = [];

                                          let dlt = JSON.parse(dt[0].valueInput, function(key, val)
                                          if (key === 'name')
                                          nameArray.push(val);

                                          )

                                          console.log(nameArray)








                                          share|improve this answer













                                          You can use an array variable and the callback function of JSON.parse to get the name key & val






                                          let dt = [
                                          "assetName": "LCT",
                                          "assetValue": "",
                                          "typeValueInput": "select",
                                          "valueInputSelect": null,
                                          "required": true,
                                          "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                          ];
                                          let nameArray = [];

                                          let dlt = JSON.parse(dt[0].valueInput, function(key, val)
                                          if (key === 'name')
                                          nameArray.push(val);

                                          )

                                          console.log(nameArray)








                                          let dt = [
                                          "assetName": "LCT",
                                          "assetValue": "",
                                          "typeValueInput": "select",
                                          "valueInputSelect": null,
                                          "required": true,
                                          "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                          ];
                                          let nameArray = [];

                                          let dlt = JSON.parse(dt[0].valueInput, function(key, val)
                                          if (key === 'name')
                                          nameArray.push(val);

                                          )

                                          console.log(nameArray)





                                          let dt = [
                                          "assetName": "LCT",
                                          "assetValue": "",
                                          "typeValueInput": "select",
                                          "valueInputSelect": null,
                                          "required": true,
                                          "valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"
                                          ];
                                          let nameArray = [];

                                          let dlt = JSON.parse(dt[0].valueInput, function(key, val)
                                          if (key === 'name')
                                          nameArray.push(val);

                                          )

                                          console.log(nameArray)






                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Mar 25 at 8:56









                                          brkbrk

                                          32.1k3 gold badges24 silver badges47 bronze badges




                                          32.1k3 gold badges24 silver badges47 bronze badges





















                                              0














                                              Here is a way to do it.



                                              let originalData = [

                                              "assetName":"LCT",
                                              "assetValue":"",
                                              "typeValueInput":"select",
                                              "valueInputSelect":null,
                                              "required":true,
                                              "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                                              ];

                                              let valueInput = JSON.parse(originalData[0].valueInput);

                                              let data = valueInput.data;

                                              console.log(data);

                                              for (var i = 0; i < data.length; i++)
                                              console.log(data[i].name);



                                              See jsfiddle https://jsfiddle.net/3s1na4eL/3/



                                              Let me know if there are any questions.






                                              share|improve this answer



























                                                0














                                                Here is a way to do it.



                                                let originalData = [

                                                "assetName":"LCT",
                                                "assetValue":"",
                                                "typeValueInput":"select",
                                                "valueInputSelect":null,
                                                "required":true,
                                                "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                                                ];

                                                let valueInput = JSON.parse(originalData[0].valueInput);

                                                let data = valueInput.data;

                                                console.log(data);

                                                for (var i = 0; i < data.length; i++)
                                                console.log(data[i].name);



                                                See jsfiddle https://jsfiddle.net/3s1na4eL/3/



                                                Let me know if there are any questions.






                                                share|improve this answer

























                                                  0












                                                  0








                                                  0







                                                  Here is a way to do it.



                                                  let originalData = [

                                                  "assetName":"LCT",
                                                  "assetValue":"",
                                                  "typeValueInput":"select",
                                                  "valueInputSelect":null,
                                                  "required":true,
                                                  "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                                                  ];

                                                  let valueInput = JSON.parse(originalData[0].valueInput);

                                                  let data = valueInput.data;

                                                  console.log(data);

                                                  for (var i = 0; i < data.length; i++)
                                                  console.log(data[i].name);



                                                  See jsfiddle https://jsfiddle.net/3s1na4eL/3/



                                                  Let me know if there are any questions.






                                                  share|improve this answer













                                                  Here is a way to do it.



                                                  let originalData = [

                                                  "assetName":"LCT",
                                                  "assetValue":"",
                                                  "typeValueInput":"select",
                                                  "valueInputSelect":null,
                                                  "required":true,
                                                  "valueInput":""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"

                                                  ];

                                                  let valueInput = JSON.parse(originalData[0].valueInput);

                                                  let data = valueInput.data;

                                                  console.log(data);

                                                  for (var i = 0; i < data.length; i++)
                                                  console.log(data[i].name);



                                                  See jsfiddle https://jsfiddle.net/3s1na4eL/3/



                                                  Let me know if there are any questions.







                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered Mar 25 at 8:59









                                                  Kabelo TookaKabelo Tooka

                                                  1841 silver badge10 bronze badges




                                                  1841 silver badge10 bronze badges





















                                                      0














                                                      You can do:






                                                      const arr = ["assetName": "LCT","assetValue": "","typeValueInput": "select","valueInputSelect": null,"required": true,"valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"];

                                                      arr.forEach(o => JSON.parse(o.valueInput).data.forEach((id, name) => console.log(id, name)));








                                                      share|improve this answer





























                                                        0














                                                        You can do:






                                                        const arr = ["assetName": "LCT","assetValue": "","typeValueInput": "select","valueInputSelect": null,"required": true,"valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"];

                                                        arr.forEach(o => JSON.parse(o.valueInput).data.forEach((id, name) => console.log(id, name)));








                                                        share|improve this answer



























                                                          0












                                                          0








                                                          0







                                                          You can do:






                                                          const arr = ["assetName": "LCT","assetValue": "","typeValueInput": "select","valueInputSelect": null,"required": true,"valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"];

                                                          arr.forEach(o => JSON.parse(o.valueInput).data.forEach((id, name) => console.log(id, name)));








                                                          share|improve this answer















                                                          You can do:






                                                          const arr = ["assetName": "LCT","assetValue": "","typeValueInput": "select","valueInputSelect": null,"required": true,"valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"];

                                                          arr.forEach(o => JSON.parse(o.valueInput).data.forEach((id, name) => console.log(id, name)));








                                                          const arr = ["assetName": "LCT","assetValue": "","typeValueInput": "select","valueInputSelect": null,"required": true,"valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"];

                                                          arr.forEach(o => JSON.parse(o.valueInput).data.forEach((id, name) => console.log(id, name)));





                                                          const arr = ["assetName": "LCT","assetValue": "","typeValueInput": "select","valueInputSelect": null,"required": true,"valueInput": ""data":["name":"name1","id":"12","name":"name2","id":"13","name":"name3","id":"14"]"];

                                                          arr.forEach(o => JSON.parse(o.valueInput).data.forEach((id, name) => console.log(id, name)));






                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited Mar 26 at 2:39

























                                                          answered Mar 25 at 8:53









                                                          Yosvel QuinteroYosvel Quintero

                                                          12.5k4 gold badges27 silver badges31 bronze badges




                                                          12.5k4 gold badges27 silver badges31 bronze badges













                                                              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