wso2 / streaming-integrator

A stream processing runtime that allows connecting any streaming data source to any destination and act on it
Apache License 2.0
113 stars 50 forks source link

Invalid json string error thrown in JsonSinkMapper #228

Closed dilini-muthumala closed 3 years ago

dilini-muthumala commented 3 years ago

Description: The JSON sink mapper thorws the followng error when tryong to create a nested json format.

ERROR {io.siddhi.extension.map.json.sinkmapper.JsonSinkMapper} - Invalid json string : {"event":{"alertTypeData":{"PublisherName":"ee","AlertCategory":"rr","AlertType":"rr"},"recipientData":{"recipientType":"rr"}. Hence dropping the message.

Affected Product Version: wso2si-4.0.0, wso2si-tooling-4.0.0

OS, DB, other environment details and versions: N/A

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;

Related Issues: https://github.com/wso2/product-sp/issues/1075