Creating an OJAI Query Condition Using a JSON String

You can create a query condition using OJAI syntax to specify the condition in JSON format.

The following example shows you how to create the following query condition using the syntax:

(a.b.[0].boolean == false && (a.c.d != 5 || a.b[1].decimal > 1 || a.b[1].decimal < 10))

This is a Java string for the condition:

String jc = new String(
    '{ \
        "$and":[ \
            {"$eq":{"a.b[0].boolean":false}}, \
            {"$or":[ \
                {"$ne":{"a.c.d":5}}, \
                {"$gt":{"a.b[1].decimal":1}}, \
                {"$lt":{"a.b[1].decimal":10}} \
            ]} \
        ]} \

Pass the string to the Query.where method. See the Java - OJAI Query Condition in JSON Format example at Querying with Conditions for a complete Java code example.

To learn about the complete OJAI syntax for query conditions, see OJAI Query Condition Syntax.