0

i am trying to send json object value with API URL, Eg : http://sded_url/designweb/project/75/49/jsonobject_arrsay_value

But the API is returning me :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid URL</h2>
<hr><p>HTTP Error 400. The request URL is invalid.</p>
</BODY></HTML>

Can anyone tell me , how will i send jsononject array in API URL

1 Answers1

0

json object template has special characters({, }, :, [, ]). you can use encodeURIComponent() method to make proper url string.

http://www.w3schools.com/jsref/jsref_encodeuricomponent.asp

yfpayalan
  • 33
  • 1
  • 9
  • yes, already i am using it : var Details = encodeURIComponent(JSON.stringify(projectDetail));.....still i am returning http 400 error and bad request – affan shaikh Feb 15 '16 at 10:22
  • i have just found a topic similar to yours. http://stackoverflow.com/questions/19910021/javascript-object-json-to-url-string-format – yfpayalan Feb 15 '16 at 11:58