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

Expose com.mongodb.util.ClassMapBasedObjectSerializer to Allow Overriding of ObjectSerializers for Specific Types

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • JSON
    • None

    Description

      I noticed that JSONSerializers.getStrict() and JSONSerializers.getLegacy() are implemented using the package-accessible com.mongodb.util.ClassMapBasedObjectSerializer class.

      In the case of org.bson.types.Binary, the legacy serializer doesn't produce valid JSON; it produces a bare, unquoted string <Binary Data>. The strict serializer produces valid JSON (quoted) string but obviously can be very, very verbose.

      I'd like to be able to override the serializer and produce something in between the legacy and strict implementations for Binary: a valid JSON string that's a truncated string representation that the strict implementation outputs. This would require making the com.mongodb.util.ClassMapBasedObjectSerializer public.

      Attachments

        Activity

          People

            Unassigned Unassigned
            stephen.lee Stephen Lee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: