json

Struts2 JSON Plugin not working with "lazy" data

I have an Entity with a OneToOne relation that is fetched lazily: @Entity public class Person { @Id private Integer id; @Column(length=60) private String address; @OneToOne(fetch=FetchType.LAZY) @JoinColumn(name="idProvince") private Province province; } This is the test I do, trying to get all the entiti...

Why should I use JSON with ASP.NET?

Why should I use JSON with ASP.NET? Can you give a practical example? I have read articles but not so good. ...

Represent a query string in JSON

I have this Javascript data: [{id:123,type:"test"},{id:154,type:"another"}] How would you transform that into something so that I can pass it as a HTTP post request? menu[0][id] = 123 menu[0][type] = test menu[1][id] = 154 menu[1][type] = another I dont want to pass the actual JSON data, I want to clean it up and pass it as formatt...

Expose a specific .net object as JSON

I'm currently enabling JSON calls to my web services using the ScriptService attribute. The problem is that one of my classes references a second class and .Net is not picking up and writing out the JavaScript for the second class. As a workaround I can write a dummy method that just returns the second class. Then .Net writes the JS...

iPhone SQLite DB and Web-based DB synchronization and interaction recommendations

I'm in the process of developing my second iPhone application, and am looking for architectural recommendations on DB handling. The idea is: 1. A database of information is stored on a server (LAMP stack), and information is delivered to the device via JSON. This part has been implemented. The user is able to "favorite" an item in th...

DataTable to JSON

I recently needed to serialize a datatable to JSON. Where I'm at we're still on .Net 2.0, so I can't use the JSON serializer in .Net 3.5. I figured this must have been done before, so I went looking online and found a number of different options. Some of them depend on an additional library, which I would have a hard time pushing thro...

What is the practical difference between xml, json, rss and atom when interfacing with Twitter?

I'm new to web services and as an introduction I'm playing around with the Twitter API using the Twisted framework in python. I've read up on the different formats they offer, but it's still not clear to me which one I should use in my fairly simple project. Specifically the practical difference between using JSON or XML is something I'd...

How do I get the total Json record count using JQuery?

I couldn't find anything about that. Here is the Json returned: {"Email":"Please enter your Email.","Password":"Please enter a password."} Here is my code: $(function() { $("#btnSubmit").click(function() { $.ajax({ url: "/account/signup", type: "POST", dataType: "json", data: { Email: $("#strEmail").val(), Pass...

Best way to generate Json-friendly result (.NET MVC)

I'm now using ListItem() for Json format result, but the generated Json text has an extra property called "selected = false", I know this is used for drop down list, but I want my app runs faster so I don't want this property. Do you know any other way to get the similar result? Here is my code: List<ListItem> list = new List<ListItem>...

How to create a controller method in Turbogears that can be called from within the controller, or rendered with a template

If you have a controller method like so: @expose("json") def artists(self, action="view",artist_id=None): artists=session.query(model.Artist).all() return dict(artists=artists) How can you call that method from within your controller class, and get the python dict back - rather than the json-encoded string of the dict (which r...

JSON datetime between Python and JavaScript

I want to send a datetime.datetime object in serialized form from Python using JSON and de-serialize in JavaScript using JSON. What is the best way to do this? ...

Conflict between avoiding anemic model and allowing serialization

In this answer to a recent question, I was advised to "be wary of making every property in your domain model have public getters and setters. That can lead you to an anemic domain model." However I then encounter the problem that an entity with private setters, like this: public class Phrase { public int PhraseId { get; private set...

xml to json roundtrip conversion

Has any work been done to provide round trip from xml to json and back again? If so, does anyone have some practical advice for doing this? I understand that you'd probably have to limit the complexity of the schema and json structure, but what's the cost on both sides? And is is too prohibitive. ...

How to read multi-level Json data by using jQuery?

Here is my Json data: [{"ok" : false, "details" : [{"n" : "Email", "v" : "The email address you entered is not correct."}, {"n" : "NameFull", "v" : "Please enter your full name."}] }] I found read sigle-level Json data is super-easy but for multi-level data like above I couldn't find a...

Convert a multidimensional javascript array to JSON?

What is the best way of converting a multi-dimensional javascript array to JSON? ...

Custom C# data transfer objects from javascript PageMethods.

I've created a custom object that I'd like to return in JSON to a javascript method. This object was created as a class in C#. What's the best way to return this object from a PageMethod ([WebMethod] if you like) to a javascript onPageMethodCallback() function? I need to be able to access the properties of this object via javascript...

JSon object value from PHP

Dear All I am using Json in php, Now I need to access it from javascript, How to pass json object ,to javascript? <?php $array = array("a"=>"Caucho", "b"=>"Resin", "c"=>"Quercus"); $json = json_encode($array); > Where My.js has showAll(){ alert("Show All Json Objects"); ...

JSON in JQuery

Dear all i am using php and JQuery, and JSON.Now i need to know how to parseThe JQuery data in javascript. load.php <?php ... $json =json_encode($array); ?> It Returns jQuery by following data [{"name":"STA","distance":"250","code":25}, {"name":"GIS","distance":"500","code":45}] jQuery $.getJSON("load.php", function(json...

PHP-Json Problem

Hi there.. I have to similar Json files... I can json_decode read one of them... but I can't other one... I've uploaded files to http://www.huzursuz.com/json/json_test.rar if would you like to see, "brother_a.php" is working, "brother.php" is not... I don't think this is json_decode nested limit, because files are so similar... Tha...

Is it possible to get the "schema" of a json file?

So, I have a json file and I want to get the names of all the fields in the file using javascript. Is there a better way other than using eval and then using reflection on the resulting object? Or does that make no sense? Thanks. ...