ISSUE
I want to call JSON.stringify passing the fields I want to include in the string. One of the fields I want to include is an object. The JSON.stringify method does not include any of the fields from the object as I would have expected.
Here is a small subset of my larger object;
var person = {
name: "John Doe",
Address: { Line1: "100 north main", City: "Des Moines" },
Phone: "555-5555"
}
Here is the stringify method call
console.log(JSON.stringify(person,["name","Address"]));
Here is the results
"{\"name\":\"John Doe\",\"Address\":{}}"
Here is a js bin I created - http://jsbin.com/UYOVufa/1/edit?html,console.
I could always stringify just the person.Address and combine it with another string, but it feels like overkill.
What am I missing?
Thanks,