-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

The JavaScript JSON Cookbook
By :

BSON encoding is a reasonable alternative to JSON if you have an implementation of an encoder and decoder on each side of the connection. Unfortunately, there's no good encoder and decoder available yet for JavaScript, but there are implementations for a number of other platforms, including .NET and C++. Let's look at how to encode a class using BSON with Json.NET in C#.
First, you'll need to have the Json.NET assembly available to your application. As you saw in the last chapter, in the recipe How to deserialize an object using Json.NET, the easiest way to do this is with NuGet. If you haven't already, add the Json.NET assembly to your solution using the steps in that recipe.
Using Json.NET to encode BSON is fairly simple, once you have a class you want to encode:
public class Record { public string Callsign { get; set; } public double Lat { get; set; } public double Lng { get; set; } } …...
Change the font size
Change margin width
Change background colour