Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to send ArcGIS JavaScript Geometry Object JSON string to Asp.Net Handler. I am using JQuery Ajax request to post the Geometry Data. I am not able to pass JSON geometry like this JSON.stringify(geometry.toJson()). Here is my code.

var jsondata = JSON.stringify(geometry.toJson());

$('#ajax-button').click(function () { 
    data: jsondata,
    contentType: "application/json; charset=utf-8",
    dataType: 'json',
    success: function (r) { 
      $('input:file').MultiFile('reset'); < br >
share|improve this question
Can you post an example of what JSON.stringify(geometry.toJson()) returns? – Derek Swingley Mar 17 '12 at 20:17
It returns this {"x":-10753913.140888039,"y":4632637.5074609965,"spatialReference":{"wkid":10210‌​0}}. If i send this text it works fine ,i am able to receive this in server. <br> data: '{"x":-10753913.140888039,"y":4632637.5074609965,"spatialReference":{"wkid":1021‌​00}}' <br>But not working for this data: JSON.stringify(geometry.toJson()) – SureshRajamani Mar 19 '12 at 6:49
I'm not nearly as experienced with jQuery so I'm not sure what's going on. I hate to be the person to suggest "do it another way" but have you tried with the methods bundled with the JSAPI? You would replace ajaxSubmit() with esri.request(). I would also use dojo.toJson() as it works in more browsers natively. – Derek Swingley Mar 19 '12 at 17:38
Thanks Derek Swingley.I solved this issue by posting the json string in hidden field and sent to server and it works.Also dojo.toJson() is replaced by JSON.stringify(obj) This is new one by dojo. – SureshRajamani Mar 20 '12 at 10:41
Glad you got it figured out. You should post your solution as an answer so that this question will show as answered. – Derek Swingley Mar 20 '12 at 21:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.