Skip to main content
Known Participant
May 10, 2024 8:29 AM UTC
Question

Single quotes string

Hi Team,

Beginner here.


I need to send a message to a Kafka topic that's used by another team. To do this, we're using a plugin that accepts messages(parameter) as text. The message I need to send is a dictionary in Appian, and I'm converting it into a JSON string using a!toJson(). so that the other team can parse it. However, the other team expects the dictionary to be enclosed in single quotes, like this: '{"a": "hello", "b": 1}'.

I have few questions:

  1. Is it possible to create such string enclosed in single quotes in Appian?
  2. In the Expression Editor's output tab, there are three formats: "formatted," "raw," and "expression." Which one should I consider as a output. I mean the output format we see will be different while passing into pv! right. for example {"a","b","c"} will be shown in the output as below(image), but in the instance if we look at the PV! it will be something like a;b;c
    but another team expecting it to be something like this '{"a":"hello","b":"world","c":23}' (with single quotes)


    Thanks in advance







     [mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05] 
    [mention:b45a4f6a20b14a008e4e0ec732a8bf98:e9ed411860ed4f2ba0265705b8793d05] 

    4 replies

    stefanhelzle0001
    Brainy
    May 10, 2024 8:34 AM UTC

    The output format is only a visual we use to better understand the output of an expression. It has zero impact at execution time.

    A JSON string is expected to be in single quotes ?!?!? Never heard of this, sounds weird, but it is what it is ...

    toJson() returns a simple string. Now, you can wrap that string into any characters you want.

    "'" & tojson() & "'"

    Known Participant
    May 10, 2024 8:43 AM UTC
    ?!?!? Never heard of this, sounds weird, but it is what it is ...

    I think the special characters in my questions appears different when you're viewing. Is that you're asking Stefan?


    stefanhelzle0001
    Brainy
    May 10, 2024 8:52 AM UTC

    No. It is about the requirement "the other team expects the dictionary to be enclosed in single quotes".