Posts Tagged ‘json’

Generating JSON from SQL

May 3, 2017 Leave a comment

Generating JSON in PostgreSQL can be several times faster than copying the relational data to the application and then generating the JSON.


Categories: Interesting, postgresql Tags: , ,

Redis as a JSON store

April 21, 2017 Leave a comment

tl;dr a Redis module that provides native JSON capabilities – get it from the GitHub repository or read the docs online. Both JSON and Redis need no introduction; the former is the standard data interchange format between modern applications, whereas the latter is ubiquitous wherever performant data management is needed by them. That being the […]

via Redis as a JSON store — thoughts…

Categories: Interesting Tags: ,

Advanced Json manipulation with python

August 27, 2015 Leave a comment

Working with json:

[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> produce = {"mangoes": 4, "oranges": 1, "bananas": 5}
>>> json.loads(produce)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer

>>> json_string = json.dumps(produce)
>>> json.loads(json_string)
{u'mangoes': u'4', u'bananas': u'5', u'oranges': u'1'}