• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

Receiving `[invalidJSON]` error when making FusionAuth API calls

Scheduled Pinned Locked Moved Solved
Q&A
api error json
1
2
1.8k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    spencer
    last edited by dan 28 Feb 2023, 15:13

    I am making an API request to FusionAuth to register a user, but FusionAuth is responding with an [invalidJSON] error code. The detailed message is:

    Invalid JSON in the request body. The property
    was [unknown]. The error was [Unexpected mapping exception]. The detailed exception was [Unexpected end-of-input in field name\n' +
    ' at [Source: (org.apache.catalina.connector.CoyoteInputStream); line: 1, column: 84] (through reference chain: io.fusionauth.domain.api.user.RegistrationRequest["user"])].'

    The same POST request works in the browser, but it does not work when using the Axios HTTP Client.

    1 Reply Last reply Reply Quote 0
    • S
      spencer
      last edited by 28 Feb 2023, 15:17

      HTTP clients, not just Axios, may impose their own requirements for building a valid request or have their own quirks to deal with.

      In this case the error can be resolved by providing a Content-Length header with the length of the JSON request data when making the API request via Axios.

      If you experience issues with a particular HTTP client, it may be helpful to compare the behavior with another client or check whether there are HTTP headers that may be required by the client.

      1 Reply Last reply Reply Quote 0
      • S spencer has marked this topic as solved on 28 Feb 2023, 15:17
      1 out of 2
      • First post
        1/2
        Last post