Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-521

JSON parser parses longs as ints

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.8.0
    • Affects Version/s: 2.6.5, 2.7.3
    • Component/s: API
    • 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:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jramish John R
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: