3

I'm looking for a way to define and send a JSON object array. I've figured out how to define a single JSON object, turn it into a string and send it, but what about an array of this type? Probably something simple I'm overlooking...

var myColumnSetting = {
  "ColumnName": name,
  "ColumnIndex": index
}

convert it to a string

var myJSONText = JSON.stringify(myColumnSetting, false);
1
  • Your example is an object, not an array. Regardless, JSON.stringify(something) should work fine. What is it returning? What are you expecting? Commented May 17, 2010 at 22:30

1 Answer 1

4
var myColumnSettings = [{"ColumnName": name, "ColumnIndex", index}, {"ColumnName":othername, "ColumnIndex":otherindex}]

would be like an array of columnsetting objects. Is this what you mean?

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

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.