json

JSON object is null, even though feed is valid JSON

Help, I'm confused. I just need to get a JSON object into my page. The URL is as follows: http://disqus.com/api/get_forum_posts/?user_api_key=MYKEY&amp;forum_id=MYID&amp;api_version=1.1 If I use the Flickr API URL and the code given in the getJSON example, it works fine: <script>$.getJSON("http://api.flickr.com/services/feeds/photos_...

How to parse json string to javascript object

I have this kind of json string: {"total":"3","data":[{"id":"4242","title":"Yeah Lets Go!","created":"1274700584","created_formated":"2010-07-24 13:19:24","path":"http:\/\/domain.com\/yeah"}{"id":"4242","title":"Yeah Lets Go!222","created":"1274700584","created_formated":"2010-07-24 13:19:24","path":"http:\/\/domain.com\/yeah222"}{"id":...

how to parse a JSON string into JsonNode in Jackson?

it should be so simple, but I just cannot find it after being trying for an hour #embarrasing I need to get a JSON string e.g. {"k1":v1,"k2":v2} parsed as a JsonNode JsonFactory factory = new JsonFactory(); JsonParser jp = factory.createJsonParser("{\"k1\":\"v1\"}"); JsonNode actualObj = jp.readValueAsTree(); gives java.lang....

Jquery ajax call: how to parse results?

I have a modal dialog (done through jquery UI) that submit a form to a remote controller Action. This is the jquery function called: $("fpForm").submit(function() { $.ajax({ type: "POST", url: "ForgotPassword", data: $("#fpForm").serialize(), success: function(response) { alert(response);...

Getting the JSON string from a Twitter search result into Java to be parsed

I am trying to get the JSON data from a Twitter search request such as this link text into my Java program so that I can parse it using Gson. How would I get the data from that URL into Java? Would I use an http request or something else? I've seen JSONRequest.get, but I can't see where that's coming from at all. ...

what is the best way to read multiple large JSON files using PHP

I am writing a PHP script (to be run from command line) to parse hundreds of large JSON files. All of these files are in a directory. Initially I was reading the files one by one and parsing them in the same script, but ran out of memory quickly. The other way to do it is to have two scripts, one to read the directory, get the list of...

how to get json data from iphone post request

Hi everyone, I am developing iphone App using JSON framework, I am calling a PHP script to update MySQL database on local server. Using these code: NSString *jsonString = [sendData JSONRepresentation]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; NSString*post = [NSString stringWithFormat:@"&json=%@", jsonString]; ...

Gson and the argonauts - problem converting javascript array, to json string, to java pojo using gson. Trying to get my structures correct

Here is my json string, that I am acessing in java: json = [ {"id":"123456","Data":"skill2","dmlcrud":false}, {"id":"123456","Data":"skill3","dmlcrud":true}, {"id":"123456","Data":"skill14","dmlcrud":true}, {"id":"123321","Data":"skill1","dmlcrud":false}, {"id":"123321","Data":"skill14","dmlcrud":false} ] I now wa...

JSON strings and how to handle escaped characters

I am using the official JSON library for my java project ad i have noticed something weird. If i have a json such as this: { "text": "This is a multiline\n text" } And i try to get the string like this: System.out.println(jsonObject.getString("text")); I get this on the output: This is a multiline\n text Instead of : This is...

JsTree returns "invalid JSON" error..

I'm trying to make a Jstree, the code for it is the following: $(function () { $("#groups") .jstree({ "plugins" : [ "themes", "json_data", "ui", "crrm", "cookies", "dnd", "search", "types", "contextmenu" ], "json_data" : { "ajax" : { "url" : base_url+"/json", "data" : f...

nesting too deep in JSON... should I switch to XML?

I am getting a JSONException complaining about a very deep nesting (more than 30). I know that the value is hardcoded in JSONWriter. what best can I do? use another library without this restriction if such thing exists? switch to XML? UPDATE: I am serializing a labeled tree structure into JSON. So starting with root, each node is nesti...

jQuery pagination for json results

What is the best way of doing a pagination? I would also need to save the current page, so that when I click a link it would save the page I was on. So if I'm on page 2 of the pagination and click one link and then get back to pagination page it would remember that I was on page 2. I get the results/data from Json request where I have o...

Validate format parameter via config in Spring MVC.

Here is my situation: I have my mvc-config.xml file for my web service set up to have JSON as the default media type. I also have favorParameter for the ContentNegotiatingViewResolver as true. Additionally, I have useNotAcceptableStatusCode as true so that not accepted formats will return a 406. My question is: Is there a way, in the c...

org.json.JSONObject constructor not accepting what appears to be a valid JSON string

I have a string in an Android app that I am trying to convert into a JSON object. The string looks like this (except longer and with actual values instead of the dummy values I entered here): [[{"1":"a"}],[{"1a":"1a","1b":"1b"},{"2a":"2a","2b":"2b"}]] I have entered this exact string into two online JSON validators, and both of them c...

Which Haskell package for JSON

There are about a dozen JSON packages on Hackage for Haskell. How do I know which package I should use? How do I get a popular opinion? Are there any statistics on which package is being used the most, downloaded the most, etc.? ...

Can't do a HTTP Post to a Web Service from my Android App

I've been working on an app that uses both GET and POST requests to Web Services. The GET requests are no problems but the POST requests are killing me. I've tried 2 different scenarios in the code. The first looks like this... HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(ws); JSONObject js...

Building a JSON Structure to Store Rules for Web Requests

I'm trying to store rules for web requests in a JSON object and am having trouble thinking of a good structure. Here are some examples of my rules: Possible Conditions the user must be logged in the user must belong to an account of type [____] the user must belong to an account named [___] the user must have a username [___] the user ...

CJSONDeserializer deserializer

Hi.. I hve code like this: NSDictionary * dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error]; i hve 2 php calling method coding is same for both. it retrieves for 1st php where as 2nd is dict 0 pair key/value , also it shows jsonstring in console. i dont know why dict is null,may be CJSONDeserialize...

How Do I Parse JSON without jQuery

Some information - I'm creating an autocomplete which gets the data from a json feed. The JSON part works fine and the result is valid. When I'm obtaining it, I'm using json2.js and running JSON.parse. When I try and output it tells me that it (the object containing the parsed JSON text) is actually undefined. If I run an alert on the...

Sending JSON via AJAX to PHP using jQuery

Hi guys, I am trying to send JSON to a PHP file using jQuery AJAX, basically what I am trying to do is get the values and id's of a bunch of child elements and then assign them to a JSON object and then send that object via ajax to the PHP file which would then process it and enter it into a database. Here is my code, Javascript/jQuer...