You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
The following app will produce proper json format for the context field:
@App:name("Test siddhi objects json mapping")
define trigger EverySecond at every 1 second;
@sink(type='log', @map(type = 'json'))
define stream LogStream (context object);
from EverySecond select
map:create(
"x",123,
"y","abcd"
) as context
insert into LogStream;
This will output the following
{ "context": { "x": 123, "y": "abcd" } }
However, when using a @payload in the mapper as follows, the context object is not formatted as proper json:
@App:name("Test siddhi objects json mapping")
define trigger EverySecond at every 1 second;
@sink(type='log', @map(type = 'json',
@payload("""{
"context": {{context}}
}
""")
)
)
define stream LogStream (context object);
from EverySecond
select
map:create(
"x",123,
"y","abcd"
) as context
insert into LogStream;
will output the following:
{ "context": {x=123, y=abcd}, }
I understand this might be complex to fix as the TemplateBuilder is unaware of which mapper (json in this case) is used.
At the end of the day, what I need is a way to produce custom json output from a stream, while being able to use siddhi objects formatted as json.
Note that this is somewhat related to siddhi-io/siddhi-map-json#81 because if I could use the same map as in a source, I would not need a custom @payload
The text was updated successfully, but these errors were encountered:
Description:
The following app will produce proper json format for the
context
field:This will output the following
However, when using a
@payload
in the mapper as follows, thecontext
object is not formatted as proper json:will output the following:
I understand this might be complex to fix as the TemplateBuilder is unaware of which mapper (json in this case) is used.
At the end of the day, what I need is a way to produce custom json output from a stream, while being able to use siddhi objects formatted as json.
Note that this is somewhat related to siddhi-io/siddhi-map-json#81 because if I could use the same map as in a source, I would not need a custom
@payload
The text was updated successfully, but these errors were encountered: