product-sp icon indicating copy to clipboard operation
product-sp copied to clipboard

Invalid json string error thrown in JsonSinkMapper

Open dilini-muthumala opened this issue 3 years ago • 1 comments

Description: In SP 4.2.0, the JSON sink mapper thorws the followng error when tryong to create a nested json format.

ERROR {org.wso2.extension.siddhi.map.json.sinkmapper.JsonSinkMapper} - Invalid json string : {"event":{"alertTypeData":{"PublisherName":"Umesha","AlertCategory":"Alert1","AlertType":"Hello"},"recipientData":{"recipientType":"Nimhani"}'}}. Hence dropping the message. (Encoded) 

Affected Product Version: SP 4.2.0

OS, DB, other environment details and versions:

Steps to reproduce:

@App:name("PreDefinedProducerApp") 
@App:description("PreDefined Local Kafka Producer App")
define stream DataStream(PublisherName string,AlertCategory String,AlertType String,recipientType String);
@sink(type='log', 
@map(type='json', enclosing.element='event', validate.json='true', @payload("""{"alertTypeData":{"PublisherName":"{{PublisherName}}","AlertCategory":"{{AlertCategory}}","AlertType":"{{AlertType}}"},"recipientData":{"recipientType":"{{recipientType}}"}}""")))
define stream DataWriteStream (PublisherName string, AlertCategory string, AlertType string, recipientType string);
from DataStream
select PublisherName, AlertCategory, AlertType , recipientType
insert into DataWriteStream;

dilini-muthumala avatar Apr 19 '21 12:04 dilini-muthumala

Fixed for the Streaming Integrator product in https://github.com/siddhi-io/siddhi/pull/1723

dilini-muthumala avatar Apr 23 '21 19:04 dilini-muthumala