Using Json.net instead of an custom Json/Bson impl.

317 views
Skip to first unread message

Steve Wagner

unread,
Feb 15, 2010, 3:49:02 AM2/15/10
to mongodb-csharp
Hi, while looking at the MongoDB-CSharp codebase i thought about, why
not use Json.Net http://www.codeplex.com/Json instead of a custom
Json/Bson inpl. Json.Net is a very good library which is stable and has
solved many Json specific problems like binary data, .Net 3.5 support
(like XDocument), Serialization, JsonSchema. So why not use it instead
of a own Document. This will reduce bugs and you can focus more on the
MongoDB specific things.

Steve

Steve Wagner

unread,
Feb 15, 2010, 3:54:15 AM2/15/10
to mongodb-csharp

GWBasic

unread,
Feb 15, 2010, 3:38:49 PM2/15/10
to mongodb-csharp
Does it support BSON? MongoDB uses BSON at its API level; BSON,
although similar to JSON, isn't JSON.

On Feb 15, 12:54 am, Steve Wagner <li...@lanwin.de> wrote:
> Hi, while looking at the MongoDB-CSharp codebase i thought about, why

> not use Json.Nethttp://www.codeplex.com/Jsoninstead of a custom

craiggwilson

unread,
Feb 15, 2010, 4:10:56 PM2/15/10
to mongodb-csharp
Yes, it supports BSON. However, Sam looked at it for a while but
decided it wasn't right. Maybe he can expand a little on that
decision.

On Feb 15, 2:38 pm, GWBasic <goo...@andrewrondeau.com> wrote:
> Does it support BSON?  MongoDB uses BSON at its API level; BSON,
> although similar to JSON, isn't JSON.
>
> On Feb 15, 12:54 am, Steve Wagner <li...@lanwin.de> wrote:
>
>
>
> > Hi, while looking at the MongoDB-CSharp codebase i thought about, why

> > not use Json.Nethttp://www.codeplex.com/Jsoninsteadof a custom

Seth Edwards

unread,
Feb 15, 2010, 4:25:02 PM2/15/10
to mongodb...@googlegroups.com
I don't see why the C# driver should have a dependency on another library. If people want to use Json.Net to serialize their Documents they can do so without having the Json.Net incorporated into the build. If you're using C# 3.0 you could easily write your own extension method to extend the Document class to use Json.Net pretty easily.

Sam Corder

unread,
Feb 15, 2010, 5:00:47 PM2/15/10
to mongodb...@googlegroups.com
The bson support in Json.Net is good and it was faster.  I looked at it to see what it would take to convert to it and decided against it due to the amount of surgery it would have taken and the extra dependency that would be introduced.  Instead I opted to see why it was faster and incorporated many of those performance improvements.  It has been a while since I did it but I remember the raw encoding and decoding of the driver became faster than the Json.Net bson encoder/decoder afterward.  The reason being is that it has much more generalized support of types whereas the driver is much more specialized to only the bson types and their .Net representations.

-Sam
Reply all
Reply to author
Forward
0 new messages