Skip to content Skip to sidebar Skip to footer

Create Javascript Json Of Class With Nested Class

I want to create a JSON object in JavaScript that has a nested object. Here are the classes: public class CellChanged { private CellLocation _Location = null; private doubl

Solution 1:

It's a lot easier than I thought.

This is the JavaScript:

var cellChanged = {
    "Location": {
        "Worksheet": workSheetCurrent
        , "Row": row
        , "Column": column
        }
     , "CellValue": cellValue
};

On the server side, deserializing using the Newtonsoft JSON library is even esaier:

CellChangedcell= JsonConvert.DeserializeObject<CellChanged>(context.Request["CellChanged"]);

Post a Comment for "Create Javascript Json Of Class With Nested Class"