У меня есть JSON:
json = {"id":"1", "gender":"male", "type":"tes"}
этот JSON, полученный от select * from mytable
из postgresql и конвертирующий этот массив в json.
Я пытаюсь вставить в couchdb, используя template.sendbody("dburl", "json")
это успешно, но когда в моей базе данных более 1 данных, json выглядит так:
json = {"id":"1", "gender":"male", "type":"tes"}, {"id":"2", "gender":"male", "type":"tes"}, json = {"id":"3", "gender":"male", "type":"tes"}
ошибка говорит:
Caused by: org.apache.camel.InvalidPayloadException: No body available of type: java.lang.String but has value: {"id":1,"gender":"male","type":"tes"},{"id":2,"gender":"male","type":"tes"} of type: java.lang.String on: Message[]. Exchange[ID-samsung-PC-1572787069541-0-15]
at org.apache.camel.component.couchdb.CouchDbProducer.getBodyAsJsonElement(CouchDbProducer.java:88) ~[camel-couchdb-2.24.0.jar:2.24.0]
at org.apache.camel.component.couchdb.CouchDbProducer.process(CouchDbProducer.java:40) ~[camel-couchdb-2.24.0.jar:2.24.0]
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[camel-core-2.24.0.jar:2.24.0]
at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186) ~[camel-core-2.24.0.jar:2.24.0]
at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86) ~[camel-core-2.24.0.jar:2.24.0]
at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541) ~[camel-core-2.24.0.jar:2.24.0]
at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506) ~[camel-core-2.24.0.jar:2.24.0]
at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369) ~[camel-core-2.24.0.jar:2.24.0]
at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506) ~[camel-core-2.24.0.jar:2.24.0]
at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229) ~[camel-core-2.24.0.jar:2.24.0]
at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144) ~[camel-core-2.24.0.jar:2.24.0]
at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161) ~[camel-core-2.24.0.jar:2.24.0]
... 23 common frames omitted
как вставить несколько JSON в диване базы данных?