JSON Server is an easy and quick-to-set-up module that you can use to fake or mock an API. You can find the basics in the documentation, and many articles regurgitate the same info. In this post, though, I intend to cover a few of the more complex things you can do with JSON Server. Read more on Fake or Mock an API with JSON Server…
In a recent project, I wanted to use Google Sheets as a content management system: the source for a print layout and a website. I wanted the content to reside in a single, easily editable location.
In order to achieve that outcome, InDesign requires the data in an XML file. But first, I had to convert the JSON data in Google Sheets to XML. This would allow me to customize the tag names to leverage the custom mapping styles feature within InDesign, which would make it a breeze to update the InDesign document as the content of the book changed. Read more on JSON to XML with AngularJS in Preparation for InDesign…
I’m currently working on an Ember.js web application that is a basic CRUD app with a twist — we don’t know all of the form fields or model attributes ahead of time, but rely on a JSON document to specify the names and types of attributes for which we need to render form controls. This presents some interesting challenges, the most significant being that our input elements don’t know what to bind their value to until they are instantiated.
After trying a few different approaches, we settled on using a pair of observers to accomplish what a more direct binding could not in this scenario. One observer watches the input’s
value property and updates the remote property value, and the other observer watches the remote property and updates the input’s
Read on for a few more details. This example uses Ember.js 1.0.0-RC.1, and we are using the same general solution in 1.0.0-RC.3. Read more on Dynamic Binding in Ember.js Using Observers…
In the battle of data formats, the two heavyweights are XML and JSON. Of late, JSON seems to be winning, in large part because most languages natively support JSON’s chosen data structures, but there’s one arena where JSON hasn’t made much of a showing: the command line. The command line provides a lot of programs to handle plain text (
sed, to name just a few), and handling XML is even supported through
xpath, but dealing with JSON has been the domain of standalone scripts written in Python, Ruby, or whatever your favorite language happens to be. There’s been few good ways to manage JSON directly from the shell. That’s why Stephen Dolan created Jq.
Read more on Handling JSON from the Command Line with Jq…
I recently had a need to create a command processor in Qt, using C++ only, on a resource-limited system. I decided to use JSON rather than implement a fully-custom protocol.
Rather than pulling a 3rd party library into my Qt application, I ran across a handy overview from the QT Wiki demonstrating how to use QScriptEngine to do the parsing and validation. Unfortunately, QScriptEngine does not support serialization of data structures to JSON, although generating JSON using QString is pretty trivial.
Routes.documents_path(). It takes parameters just like the Rails routes helpers.