Hello, I'm having some problems interacting with a JSON API and I'm pretty much out of ideas on where to go from here. It's kind of hard to post examples because I'm not really able to share the information that I'm trying to send...

Anyway, the problem is this: whenever I try to send a character like ß or any non-US characters I get an error back saying that my JSON is unprocessable. If I try the exact same string via curl though from the command-line it's fine, no issues. I'm wondering if Perl is somehow having problems with the encoding... I'm just using LWP::UserAgent to send my json strings and it works for any entries that don't have non-US characters. I know this is kind of vague, I just can't be too specific... maybe somebody has experienced something similar to this before too? Any help would be greatly appreciated!

One odd thing is that if I do a Data::Dumper on my LWP::UserAgent object after sending my json request, if I check out the content of my request it looks just fine... I can literally copy and paste the json string from my request dump into curl and it works

Thanks,

In reply to JSON Problems by nathanlong85

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.