How i can convert get/post response json into pojo class
for example i have a json like this
{
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc"},
{"value": "Open", "onclick": "OpenDoc"},
{"value": "Close", "onclick": "CloseDoc"}
]
}
}
and i have a pojo class Example.ts
declare module Example {
export interface Menuitem {
value: string;
onclick: string;
}
export interface Popup {
menuitem: Menuitem[];
}
export interface RootObject {
popup: Popup;
}
}
what should i write in success funtion so the above response convert automatically into Example.ts
$.ajax({
url:'URL',
type: "GET",
success : function(responseText)
{
alert(JSON.stringify(responseText));
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
alert("Status: " + textStatus);
}
});