Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
[{"Result":"True","isAdmin":"True","CustomerCode":"02184","CompanyCode":"1"}]


What I have tried:

[{"Result":"True","isAdmin":"True","CustomerCode":"02184","CompanyCode":"1"}] how to convert json object
Posted
Updated 5-Nov-21 3:44am

 
Share this answer
 
If you would like to send it to a REST Api

change it to string using this the bellow function
var objon = JSON.stringify([{ "Result": "True", "isAdmin": "True", "CustomerCode": "02184", "CompanyCode": "1" }]);
 
Share this answer
 
Quote:
How to get json object from json array using jquery


using jquery each[^] object
$(document).ready(function () {
           var jsonArray = [{ "Result": "True", "isAdmin": "True", "CustomerCode": "02184", "CompanyCode": "1" }];
           $(jsonArray).each(function (index, item) {

               // each iteration
               var result = item.Result;
               var isAdmin = item.isAdmin;
               var CustomerCode = item.CustomerCode;
               var CompanyCode = item.CompanyCode;
               alert(result + '|' + isAdmin + '|' + CustomerCode + '|' + CompanyCode);
           });

       });


using Javascript
var jsonArray = [{ "Result": "True", "isAdmin": "True", "CustomerCode": "02184", "CompanyCode": "1" }];
     var item = jsonArray[0];  // since there is only one item in the array, have specified the index else you shall use 'for' loop to iterate all the items
     var result = item.Result;
     var isAdmin = item.isAdmin;
     var CustomerCode = item.CustomerCode;
     var CompanyCode = item.CompanyCode;
     alert(result + '|' + isAdmin + '|' + CustomerCode + '|' + CompanyCode);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900