|
|
|
@ -10,8 +10,10 @@ import com.jayway.jsonpath.Option;
|
|
|
|
|
import com.jayway.jsonpath.PathNotFoundException; |
|
|
|
|
import com.jayway.jsonpath.Predicate; |
|
|
|
|
import com.jayway.jsonpath.internal.Utils; |
|
|
|
|
import com.jayway.jsonpath.spi.json.GsonJsonProvider; |
|
|
|
|
import com.jayway.jsonpath.spi.json.JacksonJsonProvider; |
|
|
|
|
import com.jayway.jsonpath.spi.json.JsonProvider; |
|
|
|
|
import com.jayway.jsonpath.spi.mapper.GsonMappingProvider; |
|
|
|
|
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; |
|
|
|
|
import com.jayway.jsonpath.spi.mapper.MappingProvider; |
|
|
|
|
import net.minidev.json.JSONAware; |
|
|
|
@ -604,4 +606,28 @@ public class IssuesTest extends BaseTest {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void issue_97() throws Exception { |
|
|
|
|
String json = "{ \"books\": [ " + |
|
|
|
|
"{ \"category\": \"fiction\" }, " + |
|
|
|
|
"{ \"category\": \"reference\" }, " + |
|
|
|
|
"{ \"category\": \"fiction\" }, " + |
|
|
|
|
"{ \"category\": \"fiction\" }, " + |
|
|
|
|
"{ \"category\": \"reference\" }, " + |
|
|
|
|
"{ \"category\": \"fiction\" }, " + |
|
|
|
|
"{ \"category\": \"reference\" }, " + |
|
|
|
|
"{ \"category\": \"reference\" }, " + |
|
|
|
|
"{ \"category\": \"reference\" }, " + |
|
|
|
|
"{ \"category\": \"reference\" }, " + |
|
|
|
|
"{ \"category\": \"reference\" } ] }"; |
|
|
|
|
|
|
|
|
|
Configuration conf = Configuration.builder() |
|
|
|
|
.jsonProvider(new GsonJsonProvider()) |
|
|
|
|
.mappingProvider(new GsonMappingProvider()) |
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
DocumentContext context = JsonPath.using(conf).parse(json); |
|
|
|
|
context.delete("$.books[?(@.category == 'reference')]"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|