1

I have a JSON like this:

var commpanyTags = "[{\"label\":\"Citizen\",\"category\":\"Companies\"},{\"label\":\"Citi Bank\",\"category\":\"Counterparties\"}]";

Is it possible to convert it to

var commpanyTags = [ { label: "Citizen", category: "Companies" }, { label: "Citi Bank", category: "Counterparties" } ];

If it is possible, how to do that?

2 Answers 2

4

JSON.parse (here) will do the job if you are in JavaScript land.

If you are in C#, then consider using JSON.NET to parse the JavaScript into a C# object.

Sign up to request clarification or add additional context in comments.

Comments

1
var commpanyTags = jQuery.parseJSON( commpanyTags );

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.