json

JSON is used only for JavaScript?

I am storing a JSON string in the database that represents a set of properties. In the code behind, I export it and use it for some custom logic. Essentially, I am using it only as a storage mechanism. I understand XML is better suited for this but I read that JSON is faster and preferred. Is it a good practice to use JSON if the intent...

ADO.NET Data Services - format parameter - xml / json

Has the $format parameter been removed with the VS2008 SP1 release of ADO.NET Data Services. I try to use it and I get the error: The query parameter '$format' begins with a system-reserved '$' character but is not recognized. I think the support for the Atom stuff is very cool, but can you get "plain old xml" too? ...

Which is faster asp.net mvc json or json.net?

I was wondering if anyone has run any benchmark tests on the JSON() function in Asp.net MVC and how it compares to JSON.NET? Also which one outputs the best json strings? ...

List<Map<String,Object>> to org.json.JSONObject?

List<Map<String,Object>> list = new ArrayList<Map<String,Object>>(); Map<String, Object> map = new HashMap<String, Object>(); map.put("abc", "123456"); map.put("def", "hmm"); list.add(map); JSONObject json = new JSONObject(list); try { System.err.println(json.toString(2)); } catch (JSONExce...

New to JSON, what can I do with this json response

Hi, A website returns the following JSON response, how would I consume it (in javascript)? [{"ID1":9996,"ID2":22}] Is JSON simply returning an array? ...

How to serialize a derived class in Silverlight

I created a custom control in XAML, and added some custom properties as well. Now, I want to serialize it to JSON if possible. Here is (essentially) what I have: public partial class MyCustomClass : UserControl { public Dictionary<char, int[]> ValueMap; public int Value { get; set; } } And in the code that handles serializatio...

How to pass a json url to a jquery function?

I have this loaded before the radio buttons with corresponding color variable. <script type="text/javascript"> //<![CDATA[ images = {"Black":"http:\/\/ecx.images-amazon.com\/images\/I\/31XwBA2m8pL.jpg","Slate":"http:\/\/ecx.images-amazon.com\/images\/I\/31SqWkrSb6L.jpg","White":"http:\/\/ecx.images-amazon.com\/images\/I\/31OJufgJT2L.j...

How to use JSON with Jquery?

I'm working at an app which would make a POST ajax request to a PHP script on my server. The script would query the database and return a row of records, as an array. (One array for each row, containing elements such as id, title, etc). I then want to use json_encode() to encode this array, and pass it back to the javascript which will u...

Paging Through Records Using jQuery

I have a JSON result that contains numerous records. I'd like to show the first one, but have a next button to view the second, and so on. I don't want the page to refresh which is why I'm hoping a combination of JavaScript, jQuery, and even a third party AJAX library can help. Any suggestions? ...

how to get distinct values from json in jquery

I've got a jquery json request and in that json data I want to be able to sort by unique values. so I have {"people":[{"pbid":"626","birthDate":"1976-02-06","name":'name'},{"pbid":"648","birthDate":"1987-05-22","name":'name'},..... So, far, i have this function(data){ $.each(data.people, function(i, person){ ...

Best Practice for Storing JSON Data That Will Be Passed to jQuery Plugin

I'm looking for the "best practice" as to where the JSON should be stored if it's just a string array. Should it be stored in a variable in a script block in the HTML page? Should it be stored in a JavaScript file outside of the HTML for separation? Or should it be stored in the plugin itself? If it should be an external js file, what's...

null / empty json how to check for it and not output?

I've got a json encoded dataset that I retrieve via ajax. Some of the data points I'm trying to retrieve will come back us null or empty. However, I don't want those null or empty to be displayed to the end user, or passed on to other functions. What I'm doing now is checking for if(this.cityState!='null'){ // do so...

Importing a Json String

I am attempting to import a Json string by using: AreaField areaField = new AreaField(); areaField = (AreaField)JsonConvert.Import(typeof(AreaField), HdnData.Value); The class definition is as follows: public class AreaField { public List<AreaFieldItem> AreaFieldItem { set; get; } } public class AreaFieldItem { ...

Handling null strings and ints in Json

JSON ignores any parameters with null values. So, when I create a string using JsonConverter.ExportToString these properties are missing. Also any integers with null values are replaced with -2147483648 This becomes an issue when I try to deserialize this string (I am writing my own deserializer and not using Json.Import) What's the be...

Handling enums in JSON

When I serialize an object of a class with a enum property to JSON, if the value is null, the resulting json string has a name value pair like this: "controlType":"-2147483648" This causes issues when I deserialize the string to a strongly typed object. What's the best way of handling enums and nulls? ...

replacing or managing json data from ajax request

I've got a page that makes an ajax request and gets data back in json format. I needed to sort this data before adding it to the DOM, so it is put into an object with the following code function(data){ var birthDates={}; var uids={}; $.each(data.users, function(){ if(!uids[this.uid]){ ...

jquery getJson not passing any values to controller

I am trying to pass some text from a textbox to a controller to get JSON results like so function invokeAction() { var searchText = $("#SearchTextBox").val(); // Invoke MVC controller action $.getJSON("/Home/Results/" + searchText, bindResults); } If I put an alert here I can see that searchText definately...

Why microsoft made JavaScriptSerializer obsolete prior to .net 3.5 SP1 and again active after that?

JavaScriptSerializer is not obsolete after .net 3.5 SP1. Should I uses JavaScriptSerializer or the prior recommended DataContractJsonSerializer?. Also why it was made obsolete? ...

Flex JSon socket messaging

What is the best way to implement async json socket communication between Flex client and custom server? Is there a library that can listen to socket and fire event when complete json message/object is raceived? EDIT: I know that I can use Socket and listen to SOCKET_DATA event, but that triggers event whenever new data is received, wh...

TXT->JSON with Yahoo! Pipes

I have a txt file on the web, that is contructed like this: "key1 value1 key2 value2 key3 value3 ..." Can I using Yahoo! Pipes parse it to JSON? The end format should be like: {key1 : value1, key2 : value2, key3 : value3, ...} Any hint is welcome :) ...