Skip to content

Instantly share code, notes, and snippets.

@mark05e
Last active April 14, 2024 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mark05e/89774f9a620f61ad81225de8d0e0cf37 to your computer and use it in GitHub Desktop.
Save mark05e/89774f9a620f61ad81225de8d0e0cf37 to your computer and use it in GitHub Desktop.
JSON Object to inContact Studio Dynamic Data Object

JSON to inContact Studio Dynamic Data Object

Example

Input

{
  "books":[
    {"name":"Let Us C", "author":"Yashavant Kanetkar"},    
    {"name":"Rich Dad Poor Dad", "author":"Robert Kiyosaki "},  
    {"name":"Introduction to Algorithms", "author":"Cormen"}
 ]
}

Processed Output

DYNAMIC OBJ FROM $"\{\"books\":[\{\"name\":\"Let Us C\",\"author\":\"Yashavant Kanetkar\"},\{\"name\":\"Rich Dad Poor Dad\",\"author\":\"Robert Kiyosaki \"},\{\"name\":\"Introduction to Algorithms\",\"author\":\"Cormen\"}]}"

Debug Preview

image

Cyber Chef Recipie

Deep Link Url

https://gchq.github.io/CyberChef/#recipe=JSON_Minify()Find_/_Replace(%7B'option':'Simple%20string','string':'%7B'%7D,'%5C%5C%7B',true,false,true,false)Find_/_Replace(%7B'option':'Simple%20string','string':'%22'%7D,'%5C%5C%5C%5C%22',true,false,true,false)Find_/_Replace(%7B'option':'Simple%20string','string':'%5C''%7D,'%5C%5C%5C%5C%5C'',true,false,true,false)Pad_lines('Start',19,'DYNAMIC%20OBJ%20FROM%20$%22')Pad_lines('End',1,'%22')&input=ew0KICAiYm9va3MiOlsNCiAgICB7Im5hbWUiOiJMZXQgVXMgQyIsICJhdXRob3IiOiJZYXNoYXZhbnQgS2FuZXRrYXIifSwgICAgDQogICAgeyJuYW1lIjoiUmljaCBEYWQgUG9vciBEYWQiLCAiYXV0aG9yIjoiUm9iZXJ0IEtpeW9zYWtpICJ9LCAgDQogICAgeyJuYW1lIjoiSW50cm9kdWN0aW9uIHRvIEFsZ29yaXRobXMiLCAiYXV0aG9yIjoiQ29ybWVuIn0NCiBdDQp9&ieol=CRLF&oeol=CRLF

Chef Format

JSON_Minify()
Find_/_Replace({'option':'Simple string','string':'{'},'\\{',true,false,true,false)
Find_/_Replace({'option':'Simple string','string':'"'},'\\\\"',true,false,true,false)
Find_/_Replace({'option':'Simple string','string':'\''},'\\\\\'',true,false,true,false)
Pad_lines('Start',19,'DYNAMIC OBJ FROM $"')
Pad_lines('End',1,'"')

JSON Format

[
  { "op": "JSON Minify",
    "args": [] },
  { "op": "Find / Replace",
    "args": [{ "option": "Simple string", "string": "{" }, "\\{", true, false, true, false] },
  { "op": "Find / Replace",
    "args": [{ "option": "Simple string", "string": "\"" }, "\\\\\"", true, false, true, false] },
  { "op": "Find / Replace",
    "args": [{ "option": "Simple string", "string": "'" }, "\\\\'", true, false, true, false] },
  { "op": "Pad lines",
    "args": ["Start", 19, "DYNAMIC OBJ FROM $\""] },
  { "op": "Pad lines",
    "args": ["End", 1, "\""] }
]

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment