Questions tagged [json]

JSON (JavaScript Object Notation) aka the Fat Free Alternative to XML is a lightweight data exchange format inspired by JavaScript object literals. It is often used with JavaScript, Ajax, and RESTful web services but is completely language independent.

Filter by
Sorted by
Tagged with
2
votes
1answer
128 views

Most efficient way to insert into ordered sequence

I have a dashboard like interface, that can have many tabs. There can be as many or as few tabs as the user likes, with the user being allowed to re order them as they wish. Exactly like browsers do. ...
3
votes
1answer
588 views

JSON schema validator

I wrote a simple JSON schema validator. The full code is over here on gist.github.com However, the code without comment is... ...
7
votes
1answer
3k views

Solving systems of linear equations

I am working on the following problem (http://www.enigmagroup.org/missions/programming/9/). You have a 6x6 table where the first 5 columns and rows are comprised of different types of shapes, 5 total....
4
votes
1answer
1k views

Finding potential thread safety issues and race conditions in my multithreading code

I am working on a project in which I have two tables in a different database with different schemas. So that means I have two different connection parameters for those two tables to connect using JDBC-...
5
votes
1answer
877 views

Recursive XML2JSON parser

I made a Python function that takes an XML file as a parameter and returns a JSON. My goal is to convert some XML get from an old API to convert into Restful API. This function works, but it is ...
1
vote
1answer
104 views

Can this iterating javascript code be optimized?

Say I have this type of code I'd like to execute. There's some data encapsulated around a big Javascript object containing methods & properties that I'd like to extract based on comparing some ...
3
votes
2answers
179 views

jQuery form data

Could someone please help me make this code as professional as it can be? It works fine, but I feel there's a better way of doing this. I would really appreciate some guidance so I learn to code ...
3
votes
1answer
7k views

localStorage functions for website shopping cart

As part of a larger web app we are producing, I was asked to help build functionality to tie a page's shopping cart into localStorage for persistence. What follows ...
1
vote
3answers
4k views

Simple JSON writer

I am working on a way to quickly build JSON strings in Java. To this end, I have created the following two files. Assuming that I do not need to parse JSON strings for Java, is this an efficient ...
2
votes
1answer
258 views

Passing a large amount of diverse information in JSON using Symfony 2.1 and Doctrine 2

For a project I need to give a load of diverseinformation in JSON format. All the information will be used on the same page so a single call would result in the least overhead. The information all ...
3
votes
2answers
346 views

Better way to return data via AJAX?

Let's say I have three files: a page that is used for searching data called search, a file that handles requests called controller, and a file that has functions which the controller calls based on ...
5
votes
1answer
389 views

A JavaScript VM that interprets code written in JSON

I have written a simple VM in JavaScript and it interprets source code written in JSON. The JSON object must have a "exports" property, which is a dictionary that matches a string into a integer ...
11
votes
2answers
2k views

NewtonSoft Json.Net serialiser

I'm just starting to develop more in C# after being mainly a VB.NET developer and was looking for someone to critique my implementation of a NewtonSoft Json.Net serialiser. Can you provide some ...
7
votes
1answer
6k views

Handling parsing failure in Scala without exceptions

I have a Scala (Play!) application that must get and parse some data in JSON from an external service. I want to be able to gently handle failure in the response format, but it is becoming messy. What ...
7
votes
1answer
7k views

JSON templates in Python

I am looking for a general review of my project here. I have written some Python, but not enough to feel confident in my ability to produce idiomatic code. ...
5
votes
1answer
1k views

Parsing NSDictionary from NSJSONSerialization

playerObject is an NSDictionary from JSONObjectWithData:options:error. I'm trying to update ...
3
votes
1answer
458 views

JQuery Promise Interface for a (very) simple JSON Parser

I have written a parser function that returns a JQuery Promise. You can see from the code that this is the top level parser and it delegates out to two other more specific parsers. At the minute it ...
0
votes
2answers
516 views

PHP backend for an HTML5/JS mobile app

I would really appreciate any feedback on the back-end of my mobile application. I tried to keep an MVC pattern, where I considered the app to be my view. Perhaps an REST framework would have been ...
3
votes
1answer
11k views

Convert JSON to a different format (nested json)

This is really not a question. I was looking up this solution but couldn't find it anywhere. Thought of posting it here so it may save someone's time. Here was my issue: I had a JSON coming from ...
3
votes
1answer
152 views

Filtering Pinboard API results by tags

I've got a simple sinatra webapp that pulls data from Pinboard's RSS api, parses the info, and re-displays it. There are 4 tasks I need to perform with the data: I need to remove all instances of a ...
3
votes
2answers
3k views

Download image links posted to reddit.com

This is a Python script to save imgur pictures posted to reddit.com forums. I'm looking for an assessment on the design of this script and any web security issues that might exist. Obvious ...
5
votes
2answers
8k views

jQuery plugin $(node).toJSON() - convert html form to JS Object

GitHub project repo I've been working on this little function to convert an HTML form into a JSON Object having the same structure of the form. Basically it is intended to be useful in those ...
2
votes
1answer
2k views

Search script for autocomplete suggestions

The following search script creates a JSON response for an autocomplete field. The tables and fields search from are flexible to allow using the same script for different type of searches - the idea ...
8
votes
3answers
2k views

Catching multiple types of exceptions when writing JSON

I have a class which throws a lot of exceptions: ...
6
votes
2answers
6k views

Yet another JSON parser and serializer for Qt, but with additional features

I wrote QJson, a utility class in/for Qt, I need you to take a look at. It is both a JSON parser and serializer, but with extended functionality (going beyond the ...
24
votes
2answers
6k views

QJsonView: A QWidget-based json explorer for Qt

I'm developing applications using Qt which highly make usage of the JSON language to communicate, store and load data of different types. I often need a simple viewer similar to the Firebug JSON ...
2
votes
1answer
2k views

Loading a pseudo-class instance from JSON

Is there a better way to do this? ...
30
votes
1answer
6k views

JSON Serializer

Carrying on from: Yet another C++ Json Parser Yet another C++ Json Parser (Recursive) All the code is available from git hub: ThorsSerializer but only reviewing a small section here. The idea is ...
6
votes
2answers
5k views

Check if a value exists or catch an exception

I am parsing a response from server, and in case it contains the fields "chunk_number"(J_ID_CHUNK_NUMBER) and "total_chunk_number"(...
8
votes
1answer
26k views

Optimize JSON insertion to SQLite (insert … on duplicate key ignore)

In current task, I'm refactoring the code of converting JSON file into SQLite database on Android device. Code compliant with Java 6. As a benchmark, grabbing the code from remote server takes ...
6
votes
3answers
1k views

python: is my program optimal

I wrote code in python that works slow. Because I am new to python, I am not sure that I am doing everything right. My question is what I can do optimally? About the problem: I have 25 *.json files, ...
0
votes
1answer
475 views

JSON formatting and processing hierarchies

I have a properties file I'm using for GIS software. You have a feature like a road, then properties under it, like so: ...
9
votes
3answers
2k views

Stack Overflow user info fetcher

I'm starting to look at Python and its facilities. I've just tried to make one simple program using some base libraries. I would like to hear some comments about anything you've noticed - style, ...
4
votes
1answer
3k views

Yet another C++ Json Parser (Recursive)

Following on from this request Yet another C++ Json Parser A friend pointed out that he though a recursive decent parser would be more efficient. Before I agree I want to test it so I wrote it for ...
44
votes
1answer
6k views

Yet another C++ JSON parser

This is a framework for a JSON parser I put together last night. Any comments appreciated. JsonLexer.l: Breaks the input into lexemes JsonParser.y: Understands the language syntax JsonParser.h: ...
4
votes
1answer
564 views

A better way to convert an SQLObject instance into a dict

I've got this function which returns an SQLObject instance as a dict (taking into account inherited classes, properties, etc). It doesn't work right now on SQLObject classes which inherit from ...
4
votes
1answer
413 views

Testing Backbone.js

I'm writing a (nearly-)single-page app using Ruby on Rails 3.1 and Backbone.js. Thus, most of my controllers return rootless JSON, courtesy this setting as per the Backbone.js docs: ...
5
votes
1answer
4k views

Convert XSD to JSONSchema

This code is still very naive. I am trying to convert an existing XSD to JSONSchema. Firstly, pardon the variable names (I know some are really just stupid but I will fix them once I get all the ...
1
vote
2answers
1k views

JSON for one column of a csv file?

I wrote this to pull one column of data from a csv file, divide each of the results in 2, and then format it as JSON so I can do stuff with it in a web app. It works, but it feels wonky and weird. ...
3
votes
2answers
3k views

Passing HTML back inside a JSON object

I'm working on a piece of code in my MVC3 application and I'm struggling to decide if what I plan to do is a bad idea or not. I have a snippet of JavaScript that calls an MVC action that in turn ...
2
votes
1answer
249 views

Fetching / formatting / storing tweets to my database

I am periodically getting tweets, formatting them, and storing them into the database. Now the line of code I use for this is an awful lot. I was wondering if this could be improved. ...
3
votes
1answer
10k views

How to exactly work with the JSON Object and jQuery, adding info to posts

I have been working with AJAX and JSON for quite some years now, but to be honest I still do not know exactly what all the functionality are, and how to create optimized code for jQuery. So my first ...
2
votes
1answer
387 views

Best way to iterate over JSON

So this is my first time going over a pretty big nested object, was posting this up to see how I can possibly cut this down. (Some fears I have would be, I currently know the extent of the nesting (4) ...
2
votes
1answer
834 views

Converting an object into a JSON string

I wrote a Python method to convert an object and a subset of its attributes into a JSON string with a given field as the key. There's a lot of string concatenation, and I'm not too sure what the best ...
1
vote
2answers
323 views

NSAutoreleasePool with Json Data

Just need to know if I'm doing something wrong in this code. my app seem work fast now with this code. I just want to if i really understant that ...
1
vote
1answer
381 views

Book catalog demo using Knockout, jQuery, and JSON

I know this is a lot of code, but I'm not looking for any kind of detailed review of the code. I'm just hoping some nice Javascript guru can give it a once over and offer any needed advice for using ...
1
vote
1answer
215 views

Parsing XML file containing some events

I'm a beginner and have written my first Python module that parses a XML file containing some events and prints them out to stdout as JSON. I would appreciate some ...
12
votes
1answer
65k views

Making a simple call to a server

Earlier this year, before I learnt about Code Review Stack Exchange, I gave this answer in response to a question about how to combine ASP.NET, jQuery, and JSON: I keep thinking that there must be a ...
6
votes
2answers
10k views

Parsing JSON with JavaScript

I need to write some JavaScript code that will take a JSON string, parse it, and return the names of the most-deeply nested properties. For example, for this input: ...
5
votes
1answer
8k views

Is there another way / proper way of parsing this JSON array ?

I have a JSON object which holds some json_array like this: (with org.codehaus.jettison.json.*) ...