Tag: Json
.NET 3.5: JSON Serialization using the DataContractJsonSerializer. Very helpful article.
However, Microsoft's built-in JSON serialization doesn't even serialize the built-in Dictionary class in a useful way.
var foo = new Dictionary<string,string>();
foo.Add("one", "uno");
foo.Add("two", "dos");
var json = new System.Runtime.Serialization.Json.DataContractJsonSerializer(foo.GetType());
var stream = new MemoryStream();
json.WriteObject(stream, foo);
Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray()));
gives:
[{"Key":"one","Value":"uno"},{"Key":"two","Value":"dos"}]
Idiots.
Edit: FWIW, the reason behind it is that Microsoft wrote their JSON serialization as a half-assed subclass of their XML serialization, so it thinks everything's an "infoset". Infosets don't have associative arrays, hence their representation of one as an array of key value pairs.
JSON is kind of an important technology, and Microsoft allocated one day of a programmer's time to half-ass it into the .NET class libraries.
-
My one question about JSON is why it's disallowed to have the root element be any valid JSON element, instead of only allowing object or array.
¶ (0)
Tags: [Json]
-
Jayrock: JSON and JSON-RPC for .NET.
¶ (0)
Tags: [ASP.NET, Json]
-
Web Dev Bros » Blog Archive » Generate JSON from VBScript (ASP) datatypes.
¶ (0)
Tags: [Json, VBScript]
-
DBSlayer (via).
The DBacesslayer aka DBSlayer aka Släyer (as we like to call it when we're feeling ironically heavy metal) is a lightweight database abstraction layer suitable for high-load websites where you need the scalable advantages of connection pooling. Written in C for speed, DBSlayer talks to clients via JSON over HTTP, meaning it's simple to monitor and can swiftly interoperate with any web framework you choose.
¶ (0)
Tags: [Databases, Json]
-
James Clark's Random Thoughts: XML and JSON (via). JSON is fine, l2p. 
¶ (0)
Tags: [Json, XML]
-
json-taglib - Overview (via Simon). LOL.
¶ (0)
Tags: [Funny, Java, Json]
People like this commenter on Simon's blog drive me nuts enough to make me want to post about it.
you clearly do not understand the idea of a 'semantic' web. Using xml makes it possible to use that information on other places, you can include it in an xml document, like xhtml, using xlink to point to certain data elements. And another advantages: Your data is tagged. You have given it semantic meaning. [emphasis mine]
Please. As if <foo>bar</foo> has any more "semantic meaning" [1] than "foo": "bar". Symbols have meaning when some agent imparts meaning to them. I.e. something has meaning when some person or thing understands it to have a certain meaning. Just because something is "tagged" doesn't give that something any meaning. The tags have to be interpreted by some intelligence, that intelligence being either a person, or by proxy, code that a person has written to "understand" those tags by performing some action based on them. "foo":... can be interpreted just the same as <foo>...</foo> can. Get off your high horse.
(Incindentally, the epistemelogical need for unity of meaning, to me, is a very strong argument for God as the foundation of meaning. But that's a separate discussion.)
Footnotes:
[1]: this phrase irks the hell out of me as well. It's redundant. Only people who want to use more words to make themselves sound intelligent talk about "semantic meaning"
-
PHP: JSON Functions - Manual. Ooh, JSON is now built into PHP. Rock on. (Via Simon)
¶ (0)
Tags: [Json, PHP]
Json.NET - Newtonsoft, a C# implementation of JSON. Looks really good from their example... about to try it out.
Update: based on testing so far, it works great. Their example output is incorrect however. It uses single quotes, when only double quotes are allowed in JSON. But the code in fact does the right thing.
Note that the library will generate invalid JSON and include language-specific types in it, such as a date. And that's actually desirable, since if you're just using it as serialization for your own code you get what you want, and can be careful and not use language-specific types if you need to share with others.
-
Turns out JSON now has an RFC! Via Simon.
¶ (0)
Tags: [Json]
|
Generated in about 0.136s. (Used 10 db queries) |
I hate ASP.NET
I hate ASP... I was doing wonderswith PHP, then suddenly one of myclients...
Johnies: Mar 17, 6:14am