locked
JSON Parser exception

    Question

  • When we try to parse response with non-ANSI symbols (Cyrillic), json parser fails with the following exception:

           casablanca110.winrt.dll!http::json::details::JSON_Parser<wchar_t>::CreateError(struct http::json::details::JSON_Parser<wchar_t>::Token const &,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &) Unknown

    casablanca110.winrt.dll!http::json::details::JSON_Parser<wchar_t>::GetNextToken(void) Unknown
    casablanca110.winrt.dll!http::json::details::JSON_Parser<wchar_t>::ParseObject(struct http::json::details::JSON_Parser<wchar_t>::Token &) Unknown
    casablanca110.winrt.dll!http::json::details::JSON_Parser<wchar_t>::ParseValue(struct http::json::details::JSON_Parser<wchar_t>::Token &) Unknown
    casablanca110.winrt.dll!http::json::details::JSON_Parser<wchar_t>::ParseArray(struct http::json::details::JSON_Parser<wchar_t>::Token &) Unknown
    casablanca110.winrt.dll!http::json::details::JSON_Parser<wchar_t>::ParseValue(struct http::json::details::JSON_Parser<wchar_t>::Token &) Unknown
    casablanca110.winrt.dll!http::json::details::JSON_Parser<wchar_t>::ParseObject(struct http::json::details::JSON_Parser<wchar_t>::Token &) Unknown
    casablanca110.winrt.dll!http::json::details::JSON_Parser<wchar_t>::ParseValue(struct http::json::details::JSON_Parser<wchar_t>::Token &) Unknown
    casablanca110.winrt.dll!_parse_stream() Unknown
    casablanca110.winrt.dll!_parse_string() Unknown
    casablanca110.winrt.dll!http::json::value::value(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &) Unknown

    The sample of code:

    request.then([this](pplx::task<http::http_response> responseTask) {
        http::http_response response = responseTask.get();
        response.extract_string().then([=](pplx::task<casablanca::string_t> responseStringTask){
            auto responseString = responseStringTask.get();
            http::json::value jsonValue(responseString); //EXCEPTION!
        });
    });


    Thursday, October 04, 2012 7:36 PM

Answers

  • Found it, fixed it, queued it! :-)

    This will be working properly in the next refresh.

    Thanks for reporting it!

    Niklas

    Friday, October 05, 2012 6:26 PM

All replies

  • Thanks for your bug report! If you have a short example of the input, that would be very helpful to us in addressing this issue!

    Niklas

    Friday, October 05, 2012 4:25 AM
  • Niklas,

    Here is a sample of our service response:

    {
      results: [
        {"id":272655310,"name":"Андрей Иванов"}
      ]
    }



    Friday, October 05, 2012 7:04 AM
  • Thank you!

    I have reproduced the exception and we will fix this.

    Niklas

    Friday, October 05, 2012 1:17 PM
  • Found it, fixed it, queued it! :-)

    This will be working properly in the next refresh.

    Thanks for reporting it!

    Niklas

    Friday, October 05, 2012 6:26 PM