@@ -359,19 +359,19 @@ public Object getJson() {
359359 }
360360
361361 public boolean isArray (Predicate .PredicateContext ctx ) {
362- return ctx . configuration (). jsonProvider (). isArray ( parse (ctx )) ;
362+ return parse (ctx ) instanceof List ;
363363 }
364364
365365 public boolean isMap (Predicate .PredicateContext ctx ) {
366- return ctx . configuration (). jsonProvider (). isMap ( parse (ctx )) ;
366+ return parse (ctx ) instanceof Map ;
367367 }
368368
369369 public int length (Predicate .PredicateContext ctx ) {
370- return isArray (ctx ) ? ctx . configuration (). jsonProvider (). length ( parse (ctx )) : -1 ;
370+ return isArray (ctx ) ? (( List <?>) parse (ctx )). size ( ) : -1 ;
371371 }
372372
373373 public boolean isEmpty (Predicate .PredicateContext ctx ) {
374- if (isArray (ctx ) || isMap (ctx )) return ctx . configuration (). jsonProvider (). length ( parse (ctx )) == 0 ;
374+ if (isArray (ctx ) || isMap (ctx )) return (( Collection <?>) parse (ctx )). size ( ) == 0 ;
375375 else if ((parse (ctx ) instanceof String )) return ((String )parse (ctx )).length () == 0 ;
376376 return true ;
377377 }
@@ -844,8 +844,8 @@ public ValueNode evaluate(Predicate.PredicateContext ctx) {
844844 else if (res instanceof String ) return ValueNode .createStringNode (res .toString (), false );
845845 else if (res instanceof Boolean ) return ValueNode .createBooleanNode (res .toString ());
846846 else if (res == null ) return ValueNode .NULL_NODE ;
847- else if (ctx .configuration ().jsonProvider ().isArray (res )) return ValueNode .createJsonNode (res );
848- else if (ctx .configuration ().jsonProvider ().isMap (res )) return ValueNode .createJsonNode (res );
847+ else if (ctx .configuration ().jsonProvider ().isArray (res )) return ValueNode .createJsonNode (ctx . configuration (). mappingProvider (). map ( res , List . class , ctx . configuration ()) );
848+ else if (ctx .configuration ().jsonProvider ().isMap (res )) return ValueNode .createJsonNode (ctx . configuration (). mappingProvider (). map ( res , Map . class , ctx . configuration ()) );
849849 else throw new JsonPathException ("Could not convert " + res .toString () + " to a ValueNode" );
850850 } catch (PathNotFoundException e ) {
851851 return ValueNode .UNDEFINED ;
0 commit comments