desc: Tests RQL json parsing
tests:

    - cd: r.json("[1,2,3]")
      ot: [1,2,3]

    - cd: r.json("1")
      ot: 1

    - cd: r.json("{}")
      ot: "{}"

    - cd: r.json('"foo"')
      ot: '"foo"'

    - cd: r.json("[1,2")
      ot: err("RqlRuntimeError", 'Failed to parse "[1,2" as JSON.', [0])

    # Test automatic json conversion
    - py: r.exprJSON(1)
      js: r.exprJSON(1)
      rb: r.expr(1, :allow_json => true)
      ot: 1

    - py: r.exprJSON({"a":"string"})
      js: r.exprJSON({"a":"string"})
      rb: r.expr({"a" => "string"}, :allow_json => true)
      ot: ({'a':"string"})

    - py: r.exprJSON({"a":r.expr(1) + 1})
      js: r.exprJSON({"a":r(1).add(1)})
      rb: r.expr({"a" => r(1) + 1}, :allow_json => true)
      ot: ({'a':2})

    - py: r.exprJSON({'a':{'b':3}, 'b':'str', 'c':r.expr('str2')})
      js: r.exprJSON({'a':{'b':3}, 'b':'str', 'c':r.expr('str2')})
      rb: r.expr({'a' => {'b' => 3}, 'b' => 'str', 'c' => r.expr('str2')}, :allow_json => true)
      ot: ({'a':{'b':3}, 'b':'str', 'c':'str2'})

    - py: r.exprJSON({1:True})
      js: []
      rb: r.expr({1 => true}, :allow_json => true)
      ot:
        rb: err('RqlDriverError', 'Object keys must be strings or symbols.  (Got object `1` of class `Fixnum`.)', [])
        py: err('RqlDriverError', 'Object keys must be strings.', [])
