public String toJSON(PredicateQuery query) {
        try {
            StringWriter writer = new StringWriter(1024);
            toJSON(query, writer);
            return writer.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
Converts {@link PredicateQuery} to and from JSON

Example:
 {
     features: [
         {"k": "key-name", "v":"value", "s":"0xDEADBEEFDEADBEEF"}
     ],
     rangeFeatures: [
         {"k": "key-name", "v":42, "s":"0xDEADBEEFDEADBEEF"}
     ]
 }

@author bjorncs
predicate-search/src/main/java/com/yahoo/search/predicate/serialization/PredicateQuerySerializer.java