Storing and retrieving JSON Data

Some more options that you could consider.

  • Storing each field in the json document as different bin in aerospike (as explained in the answer before)

  • If you want to keep the json document in tact

  • If you know the field which you want to query on and if they are limited in number, you can serialize the json doc and store in one bin. But also save the fileds that you are interested to query on later in seperate bins and build a secondary index on them.

  • Aerospike is about to support secondary indexes on list and maps. Once this feature is available, you can convert the json doc into a map and store in a single bin aerospike. You can convert the map to json back. To convert json to/from map in java, there are libraries available (like google gson or jackson: link1, link2)