Contents tagged with JSON
-
A quick helper to work on JSON streams
Newtonsoft’s JSON library provides lots of different ways to read JSON documents, including a SAX-like way to work with the document by reading it forward-only: JsonTextReader. This is very advantageous if you’re working with very large documents, especially if they are being streamed from a remote source. Using this kind of API, there is no need to have the whole document loaded in memory at once. The downside is that those API are usually quite unfriendly and low-level: you usually have to move a cursor and read values manually. This is not just tedious, it’s also brittle and typically creates excessive coupling with the structure of the JSON document. Last week, I had to read a large JSON document, and I wanted to explore better ways to perform such tasks, which led me to write a small set of helper methods that make it a lot easier to walk JSON documents using Newtonsoft’s JsonTextReader.
-
Creating a new DecentCMS content item
Currently, DecentCMS stores content items in the file system, which is just fine for small sites, and makes editing and deploying them quite easy, even though there is no admin dashboard yet. Creating a content item is done by simply creating a file in one of the supported formats: JSON, YAML, and Snippable YAML + Markdown.
-
Snippable: a human-writable multipart document format
More and more projects are managing their documentation as a bunch of Markdown files in a repository. Sites such as Github make that really easy and convenient, by providing an easy web interface around viewing and editing Markdown files, creating and integrating pull requests, viewing changesets, etc. It seems to provide all the advantages of a wiki, and more, while using a standard and easy set of tools.
-
Can we make commas optional in JavaScript literals?
Sometimes, small improvements can go a long way to making a language more enjoyable. One thing that I seem to feel acutely for some reason is noise. Noise is those parts of the language that –with compiler changes– you could remove without changing the meaning of the program, and without making it less clear. In many cases, removing the noise would actually make the code clearer, because the reader can focus on the meaningful parts without being distracted by the noise.
-
Testing Node.js code that requires JSON files
A preferred way of creating a JavaScript object from a JSON file is to use the require function. Require will take care of the file’s encoding, and will cache the results so reading the same file a second time will not hit the file system. Testing such code can seem challenging, however.
-
Clay: malleable C# dynamic objects – part 2
In the first part of this post, I explained what requirements we have for the view models in Orchard and why we think dynamic is a good fit for such an object model.
-
Clay: malleable C# dynamic objects – part 1: why we need it
When trying to build the right data structure in Orchard to contain a view model to which multiple entities blindly contribute, it became obvious pretty fast that using a dynamic structure of sorts was a must.
-
Microsoft Ajax 4.0 Preview 4 now available
The Microsoft Ajax team made the fourth preview of the 4.0 version available on CodePlex. This is an important release because it enables the full client data story, complete with the ability to get changes back to the server automatically.
-
JavaScript Behavior Sheets: an experiment
Here’s a little experiment. I’m really after feedback on this one as I’m trying to decide whether this is a good idea. It’s also entirely possible somebody else did this before. That would be good feedback too. Anyway, here it is.
-
PDC 2008 ASP.NET AJAX Futures talk available online
The full 83 minutes of my PDC talk are available on the Channel 9 web site. You can watch the session online (using Silverlight) or download the video in a number of formats. Slides and source code for the demo are also available.