Required correct JSON format

VIKAS MISHRA
Tera Contributor

Below is the JSON format that i am using in rest API explorer, but i have doubt that this is not correct JSON format, please check is there is any mistake and help me.

 

 

{ 
"records": 
[ 
{ 
"from_date":"20191017T010000", 
"to_date":"20191018T030000" 
} 
] 
}

 

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@VIKAS MISHRA 

it's a valid JSON, it's an array of json object and has only 1 object in it which has those 2 dates

the API which you are testing should accept it

 

AnkurBawiskar_0-1746534742658.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Do you think i should add somthing next to the "record" , i mean the sys if and then only it will give me the correct data

@VIKAS MISHRA 

well it all depends on what API accepts.

Please check with the person who developed that API if it's a scripted REST API

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Abhijit4
Mega Sage

Hi @VIKAS MISHRA 

 

That's valid JSON format. You can always validate any json data with online validator like JSON Lint.

 

What makes you think this is not correct JSON format? You can share detailed use case where you are going to use this JSON so that we can help you further to build your confidence that this JSON would work for your use case.

 

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP