I have an Array that looks like this
[["BR",1],["USA",2],["CH",3]]
and I want to convert it to something like this
{"br":1,"usa":2,"ch":3};
Any clues?
Thanks guys
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This will convert into an object. You can use
JSON.stringify(hash)in newer browsers, or if you use a library like jQuery, to make it into a JSON string. Writing JSON by yourself is somewhat error-prone, best leave it to builtins and libraries.