0
Answer

How to get a JSON Format?

Maanik

Maanik

10y
442
1
I want to bind a data from table and the output should be in JSON format.
Currently am working in web service, after clicking  my method name it returns the data in JSON Format.
 
Now am getting an output as,
 
[{"ID":1,"STATE_NAMES":"ANDHRA PRADESH"},{"ID":2,"STATE_NAMES":"TAMIL NADU"},{"ID":3,"STATE_NAMES":"KARNATAKA"},{"ID":4,"STATE_NAMES":"KERALA"}]
 
My required output is,
 
{
"States":[
{
"count":4
},
{
"States_list":[
{
"ID":1,
"STATE_NAMES":"ANDHRA PRADESH"
},
{
"ID":2,
"STATE_NAMES":"TAMIL NADU"
},
{
"ID":3,
"STATE_NAMES":"KARNATAKA"
},
{
"ID":4,
"STATE_NAMES":"KERALA"
}
]
}
]
}