Separate creating JSON objects from query terms.
Add no allocate versions of term constructors.