JSON parser parses longs as ints

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 2.8.0
    • Affects Version/s: 2.6.5, 2.7.3
    • Component/s: API
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The JSON parser parses longs as ints, as in the example below. I have only checked java driver versions 2.6.5 and 2.7.3.

      BasicDBObject test = new BasicDBObject();
      test.put("num", new Long(-5312343143242334L));
      System.out.println(JSON.serialize(test)); // ok

      { "num" : -5312343143242334}

      System.out.println(JSON.parse(JSON.serialize(test))); // error

      { "num" : -1174035038}

            Assignee:
            Jeffrey Yemin
            Reporter:
            John R
            None
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: