poseidon icon indicating copy to clipboard operation
poseidon copied to clipboard

Message#value seems to be escaped

Open krisleech opened this issue 10 years ago • 5 comments

I publish, using kafka-console-producer, escaped JSON such as {\"name\":\"kris\",\"color\":\"blue\"}.

When I receive it using Poseidon I get "{\\\"name\\\":\\\"kris\\\",\\\"color\\\":\\\"blue\\\"}", which is doubly escaped.

Using ``kafka-console-consumer` I get the message as published.

Is this expected?

krisleech avatar Nov 27 '15 23:11 krisleech

However if I publish with Poseidon, producer.send_messages([Poseidon::MessageToSend.new("test_topic", "{\"name\":\"kris\",\"color\":\"blue\"}")]).

I get the expect result consuming with Poseidon, but the an unescaped result in kafka-console-consumer, {"name":"kris","color":"blue"}..

krisleech avatar Nov 28 '15 00:11 krisleech

@krisleech provide to the consoleproducer a json object not a strigified version

mensfeld avatar Dec 03 '15 16:12 mensfeld

@mensfeld Thanks for responding :smile:

How do I give a JSON object to kafka-console-producer it only accepts string input on the command line... Do you mean to give it unescaped JSON such as {"name":"kris","color":"blue"}?

krisleech avatar Dec 08 '15 10:12 krisleech

@krisleech anytime - yeah you can try providing unescaped JSON as it seems (didn't look into the source but based on the behaviour) that it is doing to_json on your 'to_jsoned' already object

mensfeld avatar Dec 08 '15 10:12 mensfeld

@krisleech if it is working, please close this issue (I can't)

mensfeld avatar Jan 04 '16 19:01 mensfeld