Considerations when Storing C# code in JSON

iKnode‘s main database has always been Postgresql, but recently we have been using MongoDB more and more. Currently we store C# code in Postgresql, which is painless, since we can just grab the input directly from the Web editor and into the the database unmodified. With MongoDb, this process is not as easy because MongoDB depends on a JSON-like format.

MongoDB stores data using BSON, which is a superset of JSON. While testing, we needed to set the default Database state to run our tests, we encountered a couple of problems while serializing C# code into JSON.

We followed these considerations to transform C# code so that it could be embedded in a JSON string:

Convert Tabs to Spaces. (In Emacs you can do this with the M-x untabify command)

2 Responses to “Considerations when Storing C# code in JSON”

iKnode is a Backend Cloud Platform, and we use C# as the base language for storing Apps. We are currently building a Package Manager for iKnode, so that you can install a whole set of applications using one JSON Script. So that is why we need to have C# be embedded in JSON.

We also considered using XML, but since we are using MongoDB, JSON seemed like the obvious choice.

Leave a Reply

Name (required)

Email (required)

Website

Comments

About

Alex Espinoza is a very passionate software developer who likes to build stuff with his computer. [Read More]