json

json changes the order of elements

Hello, I am trying to send a list of objects from an android mobile phone app to a j2ee webserver. I create json objects and then put the objects into an jsonarray(in an order) and then send it. I am able to receive the jsonarray on the server, obtain the objects individually too, but the order of how I inserted the objects into the jso...

Serializing decimal points in Django, getting error: 'ValuesListQuerySet' object has no attribute '_meta'

Is there a way I can serialize a FloatField model instance in django? I have the following in a management command: def chart_data(request): i = 1 chart = open_flash_chart() chart.title = t for manager in FusionManagers.objects.all(): net_data = manager.netio_set.values_list('Net', flat=True) clean = seria...

passing paranter from asp.net to java script by JSON in html

I want o pass some JSON object in HTML response and eval it in client. I used fallowing code in server: TagBuilder tag = new TagBuilder("script"); tag.Attributes.Add("Id", id); tag.Attributes.Add("type", "text/html"); tag.SetInnerText(new JavaScriptSerializer().Serialize(content)); return...

writing JSON object to .json file on server

I'm trying to write my JSON object to a .json file on the server. The way I'm doing this now is: JavaScript: function createJsonFile() { var jsonObject = { "metros" : [], "routes" : [] }; // write cities to JSON Object for ( var index = 0; index < graph.getVerticies().length; index++) { jsonObj...

Parsing json into java objects in spring-mvc

I'm familiar with how to return json from my @Controller methods using the @ResponseBody annotation. Now I'm trying to read some json arguments into my controller, but haven't had luck so far. Here's my controller's signature: @RequestMapping(value = "/ajax/search/sync") public ModelAndView sync(@RequestParam("json") @RequestBody Searc...

Generate Json schema from XML schema (XSD)

Does anybody know how to generate a Json schema from a existing XML schema (XSD file)? Are there any tools available for this? ...

EXTjs - Eval multi json elements

Hi, I want to take some data from the server and eval it. if i eval 1 element in the json, it works fine, but if i eval more, i get an error this is the operation (Using jquery for the ajax): ,getColsFromServer : function(){ return [new Ext.grid.RowNumberer(), Ext.util.JSON.decode('{"id":"id","dataIndex":"id","header":...

Erlang : Tuple List into JSON

I have a list of tuples which are http headers. I want to convert the list to a JSON object. I try mochijson2 but to no avail. So I have the following : [{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, {'Accept-Encoding',"gzip,deflate"}, {'Accept-La...

Deserializing self-tracking entity with nested TrackableCollection

How can I deserialize JSON string into entity of type like this (self-tracking properties removed to be simple): public class User: { int Id { get; set; } string Name { get; set; } public TrackableCollection<Role> Roles { get; set; } // <! } Role is also simple class with two properties. TrackableCollection is descendant ...

gson ignoring map entries with value=null

Gson gson = new Gson(); Map<String,Object> map = new HashMap<String, Object>(); map.put("a",1); map.put("b",null); System.out.println(gson.toJson(map));; //prints {"a":1} how do I get it to include all entries? Thank you ...

Pass a PHP string (which represents a JS function) through json_encode()

I'm using this PHP/CodeIgniter library for jQuery Highcharts: http://www.crustiz.com/php-jquery/highcharts-library-for-codeigniter/ The way that library does things is that it builds a PHP array of options, then converts it to json using json_encode (see line 273 of that library) which is then used by the jQuery Highcharts plugin. This ...

Flash CS5 on iPhone - developing client/server data apps

I am looking to develop basic client server data application to add value to a website. The website is .net based and opening an api such as asmx web service, json or xml would be simple. Can anyone tell me what are the limitations - technically, what is possible with flash and also what Apple consider to be good practice. Does anyon...

Getting started with JSON in .net and mono

I would like to keep a custom configuration file for my app and JSON seems like an appropriate format*. I know that there are JSON libraries for .NET, but I couldn't find a good comparative review of them. Also, my app needs to run on mono, so it's even harder to find out which library to use. Here's what I've found: JSON.NET JSONSh...

Help me with algorithm.. Javascript

On my page I'm making ajax-request to get data from server. The data is list of JSON objects.. Every object has name, description and datetime. How can I get the object which is the closer to my real data in browser... Example: $(json).each( function(i) { alert(json.datetime) //here have to be some algorithm to c...

How to map poco to JSON using Automapper

In my MVC 2 application I have a typical method that calls a web service, builds a JSON data object and returns it to the view. Everything works fine, but I was wondering if there is a way to do the mapping with Automapper so I can remove the ugly code from my controller. Thanks in advance Here is my Action method public virtual Actio...

Why do I need to use .d to access data returned by jQuery AJAX?

I've put together some jQuery AJAX code using some tutorials I found on the internet. I'm new to jQuery and want to learn how to do things betters. I have a coworker who put together a beautiful web application using a lot of jQuery. The thing I'm most confused about here is: why is it necessary to use the ".d" when referring to the r...

JavaBeanConverter Unmarshal fails to use Constructor

So I have a class with some objects as parameters, for example: public class Person { private String firstname; private String lastname; private School school; public Person(){ super(); } } public class School{ private String name; private String location; private Date founded; public School(){ super(); } public Schoo...

Jquery each - do index values always start at 0?

I have a spurious problem which seems to indicate the index value got from the jquery each method does not always start at 0. My javascript looks a bit like this: $("#mylist").each(function(index) { var obj = new myclass(); obj.property = "whatever"; obj.sequence = index + 1; parentobj.list.push(obj); }); This all ge...

accessing the parameters of a JSON call in the web method

I have the following JSON call, the data I'm passing seems to be getting stringify'ed properly from what i'm looking at, however, I don't seem to have the right syntax to process the parameter in the public web method. Here is the JSON call: <script type="text/javascript" language="javascript"> var qs = new Querystring(); var v1...

Unable to append content coming back in JSON

I have the following JSON coming back: {"gameId":137.0,"memberId":3,"id":97.0,"reviewBody":"Great game! Awesome.","createdAt":"October, 13 2010 18:55:34"} I'm trying to append it to a layer using the following JavaScript, but nothing is showing: $(function(){ $(".review-form").submit(function(){ dataString = $(".review-fo...