# \[Just Pushed\]: xContent - A JSON abstraction allowing for other types

**URL:** <https://discuss.elastic.co/t/just-pushed-xcontent-a-json-abstraction-allowing-for-other-types/2932>\
**Category:** Elasticsearch\
**Created:** [April 29, 2010, 8:14pm UTC](https://discuss.elastic.co/t/just-pushed-xcontent-a-json-abstraction-allowing-for-other-types/2932 "2010-04-29T20:14:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 29, 2010, 8:14pm UTC](https://discuss.elastic.co/t/just-pushed-xcontent-a-json-abstraction-allowing-for-other-types/2932/1 "2010-04-29T20:14:11Z")

</div>

Hi,

Just pushed this:  
[http://github.com/elasticsearch/elasticsearch/issues/issue/152](http://github.com/elasticsearch/elasticsearch/issues/issue/152). Basically,  
the idea I had is to create a wrapper on top of how elasticsearch handles  
JSON allowing for other wire formats (with same JSON characteristics) to be  
supported. The first implementation aside from JSON is XSON, which is an  
optimized binary format of JSON (I will doc the BNF soon).

A note for Java API users, some classes have been renamed. The previous  
JsonXXX have been removed and renamed. Also, by default, the query / filter  
builders and the search source builders use the XSON format which means  
faster operations :). It is up to you to decide how to encode the indexable  
data, either using JSON or XSON. ElasticSearch will automatically handle  
both.

cheers,  
shay.banon

---

<div class="post-metadata">

**Author:** ![Sergio\_Bossa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergio_bossa/32/3312_2.png) [@Sergio\_Bossa](https://discuss.elastic.co/u/Sergio_Bossa)\
**Post date:** [April 29, 2010, 8:19pm UTC](https://discuss.elastic.co/t/just-pushed-xcontent-a-json-abstraction-allowing-for-other-types/2932/2 "2010-04-29T20:19:55Z")

</div>

Hi Shay,

sounds very cool, but why didn't you use BSON ([http://bsonspec.org](http://bsonspec.org)),  
rather than your own binary format?

On Thu, Apr 29, 2010 at 10:14 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> Hi,  
> Just pushed  
> this: [XContent - An abstraction on top of content (JSON inspired) · Issue #152 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/152).  
> Basically, the idea I had is to create a wrapper on top of how elasticsearch  
> handles JSON allowing for other wire formats (with same JSON  
> characteristics) to be supported. The first implementation aside from JSON  
> is XSON, which is an optimized binary format of JSON (I will doc the BNF  
> soon).  
> A note for Java API users, some classes have been renamed. The previous  
> JsonXXX have been removed and renamed. Also, by default, the query / filter  
> builders and the search source builders use the XSON format which means  
> faster operations :). It is up to you to decide how to encode the indexable  
> data, either using JSON or XSON. Elasticsearch will automatically handle  
> both.  
> cheers,  
> shay.banon

--  
Sergio Bossa  
[http://www.linkedin.com/in/sergiob](http://www.linkedin.com/in/sergiob)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 29, 2010, 8:21pm UTC](https://discuss.elastic.co/t/just-pushed-xcontent-a-json-abstraction-allowing-for-other-types/2932/3 "2010-04-29T20:21:37Z")

</div>

BSon might also be supported, but I don't really like the format as its not  
aimed at streaming data (pull parsing). For example, you need to write the  
size of the array before you write all its elements. This is an aspect of  
JSON that I really wanted to preserve.

Also, BSON is a superset of JSON, while XSON is exactly like JSON.

cheers,  
shay.banon

On Thu, Apr 29, 2010 at 11:19 PM, Sergio Bossa [sergio.bossa@gmail.com](mailto:sergio.bossa@gmail.com)wrote:

> Hi Shay,
> 
> sounds very cool, but why didn't you use BSON ([http://bsonspec.org](http://bsonspec.org)),  
> rather than your own binary format?
> 
> On Thu, Apr 29, 2010 at 10:14 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Hi,  
> > Just pushed  
> > this: [http://github.com/elasticsearch/elasticsearch/issues/issue/152](http://github.com/elasticsearch/elasticsearch/issues/issue/152).  
> > Basically, the idea I had is to create a wrapper on top of how  
> > elasticsearch  
> > handles JSON allowing for other wire formats (with same JSON  
> > characteristics) to be supported. The first implementation aside from  
> > JSON  
> > is XSON, which is an optimized binary format of JSON (I will doc the BNF  
> > soon).  
> > A note for Java API users, some classes have been renamed. The previous  
> > JsonXXX have been removed and renamed. Also, by default, the query /  
> > filter  
> > builders and the search source builders use the XSON format which means  
> > faster operations :). It is up to you to decide how to encode the  
> > indexable  
> > data, either using JSON or XSON. Elasticsearch will automatically handle  
> > both.  
> > cheers,  
> > shay.banon
> 
> --  
> Sergio Bossa  
> [http://www.linkedin.com/in/sergiob](http://www.linkedin.com/in/sergiob)

---

<div class="post-metadata">

**Author:** ![Sergio\_Bossa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergio_bossa/32/3312_2.png) [@Sergio\_Bossa](https://discuss.elastic.co/u/Sergio_Bossa)\
**Post date:** [April 29, 2010, 8:47pm UTC](https://discuss.elastic.co/t/just-pushed-xcontent-a-json-abstraction-allowing-for-other-types/2932/4 "2010-04-29T20:47:36Z")

</div>

Thanks, I'll take a look.

Sergio Bossa  
Sent by iPhone

Il giorno 29/apr/2010, alle ore 22.21, Shay Banon \<[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)

> ha scritto:

> BSon might also be supported, but I don't really like the format as  
> its not aimed at streaming data (pull parsing). For example, you  
> need to write the size of the array before you write all its  
> elements. This is an aspect of JSON that I really wanted to preserve.
> 
> Also, BSON is a superset of JSON, while XSON is exactly like JSON.
> 
> cheers,  
> shay.banon
> 
> On Thu, Apr 29, 2010 at 11:19 PM, Sergio Bossa  
> [sergio.bossa@gmail.com](mailto:sergio.bossa@gmail.com) wrote:  
> Hi Shay,
> 
> sounds very cool, but why didn't you use BSON ([http://bsonspec.org](http://bsonspec.org)),  
> rather than your own binary format?
> 
> On Thu, Apr 29, 2010 at 10:14 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Hi,  
> > Just pushed  
> > this: [Issues · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/)
> 
> 1. 
> 
> > Basically, the idea I had is to create a wrapper on top of how  
> > elasticsearch  
> > handles JSON allowing for other wire formats (with same JSON  
> > characteristics) to be supported. The first implementation aside  
> > from JSON  
> > is XSON, which is an optimized binary format of JSON (I will doc  
> > the BNF  
> > soon).  
> > A note for Java API users, some classes have been renamed. The  
> > previous  
> > JsonXXX have been removed and renamed. Also, by default, the  
> > query / filter  
> > builders and the search source builders use the XSON format which  
> > means  
> > faster operations :). It is up to you to decide how to encode the  
> > indexable  
> > data, either using JSON or XSON. Elasticsearch will automatically  
> > handle  
> > both.  
> > cheers,  
> > shay.banon
> 
> --  
> Sergio Bossa  
> [http://www.linkedin.com/in/sergiob](http://www.linkedin.com/in/sergiob)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:24am UTC](https://discuss.elastic.co/t/just-pushed-xcontent-a-json-abstraction-allowing-for-other-types/2932/5 "2017-07-06T04:24:21Z")

</div>


