How to handle a partial json string & partial pojo and convert string to bson?

I found that new JsonObject(jsonString); is throwing an error because the jsonString is for a simple type (string, int, double as “someStringHere”, “123”, “45.67” etc) and not an actual object starting with “{” and ending with “}”.
How can I convert the jsonString to a BsonValue instead since that can have simple types?
Specifically is there an implementation of the parser given in specifications/extended-json.rst at master · mongodb/specifications · GitHub

The object that we write into mongodb is partly a POJO and partly JSON string for flexibility. We’re using the POJO registry and found that the productAttributes is getting stored as a string so we can’t index on actual attributes within it. For e.g.

class Product {
    ProductIdentifier id; // this structure is fixed and known
    String productAttributes; // this is a json string for flexibility, can have many attributes in it
    double cost;
    int quantity;
}
class ProductIdentifier {
    String id;
    String domain;
}

We found that if we change productAttributes to a Map<String, JsonObject> then it is stored correctly in the DB but then value of the map can’t be simple types.