PricingBlog

trying to parse json with \n and \"

  • rscott-1214798676610781184

    Bishop

    1 year ago

    The result of this one query comes back with \n between lines and " for quotes which causes it to fail to parse into a variable.

    i cannot figure out how to get rid of it. Trying to replace \n results in nothing happening. \n also nothing. \ and \, same deal.

    If I copy the string out the convert json and put it into a string, it parses it just fine. So the invisible \n and " are the things screwing it up.

    😦
    1214798687444672582-Screenshot_2024-03-05_at_10.55.26_PM.png
  • lucasg-1214801401536974899

    Lucas G

    1 year ago

    That’s a json string. It basically needs to be encoded into json
  • stockton_f-1214801743594913812

    Stockton

    1 year ago

    Parse JSON should work but get rid of the replace all node
  • rscott-1214802195485302796

    Bishop

    1 year ago

    ok yeah guys I already did not have the replace all node, and it worked until this one query. I'm trying to figure out a way to make this result work.

    This image is from my database, its part of the query and its inserting \n (double )

    which I think is screwing things up.
    1214802194914607204-Screenshot_2024-03-05_at_11.08.02_PM.png
    1214802195325652992-Screenshot_2024-03-05_at_11.07.52_PM.png
  • all these \ns are coming in answer as \n
  • rscott-1214802682540331038

    Bishop

    1 year ago

    i can't even write it, because discord is removing the first \
  • \n
  • its backslash backslash n, not just backslash n
  • i want to strip out just 1 \
  • 1214803023633719346-Screenshot_2024-03-05_at_11.13.27_PM.png
  • i guess? i mean, its in a string so its kind of like replacing \\n with \n
  • damnit discord took it out agian
  • i need to do this
    1214803255515807794-Screenshot_2024-03-05_at_11.14.17_PM.png
  • stockton_f-1214803437405868042

    Stockton

    1 year ago

    lol
  • rscott-1214803491915173918

    Bishop

    1 year ago

    its so annoying
  • stockton_f-1214803560211025941

    Stockton

    1 year ago

    Is it getting double encoded in the server?
  • rscott-1214803579911667762

    Bishop

    1 year ago

    i think i solved it at xano level
    ☝️1
  • 1214803672765169694-Screenshot_2024-03-05_at_11.15.58_PM.png
  • stockton_f-1214803811907018772

    Stockton

    1 year ago

    Nice
  • rscott-1214804034792325150

    Bishop

    1 year ago

    yeah maybe not
  • stockton_f-1214804388686594088

    Stockton

    1 year ago

    My guess is there's some double encoding happening in xano somewhere. But not too familiar with it or the requests you're making.
  • rscott-1214818955219439646

    Bishop

    1 year ago

    so now instead i let it not make \n lines and i'm trying to join the multiple array entries with \n between them

    So
    That It
    Formats Like This

    and its giving me \n

    starting to feel like i need a custom function 😦
    1214818953935724634-Screenshot_2024-03-06_at_12.15.37_AM.png
    1214818954820845579-Screenshot_2024-03-06_at_12.15.32_AM.png
  • rscott-1214957270375338055

    Bishop

    1 year ago

    man this is frustrating is there a way to join these without using custom function or action
  • lucasg-1214962403348054096

    Lucas G

    1 year ago

    The main JSON string is valid
  • lucasg-1214962897432739890

    Lucas G

    1 year ago

    If it isn't outputting in the format that you want, perhaps take a look at how the JSON is being created/saved in the first place
  • lucasg-1214963483280547860

    Lucas G

    1 year ago

    It looks like the sugs value is being saved as a string value
  • 767452073251438612-@Bishop
    lucasg-1214965036817055764

    Lucas G

    1 year ago

    Looking at this:
    {"sugs": --> " <-- { "suggestions....."
    The entire sugs value is being saved as a string. The quotation marks wouldn't be wrapping it all if it was a json object
  • So technically it is parsing correctly