com.fasterxml.jackson.core.JsonParseException

Unrecognized token 'swagger': was expecting ('true', 'false' or 'null') at [Source: swagger: "2.0"info: version: 1.0.0 title: Swagger Petstore license: name: MIThost: petstore.swagger.wordnik.combasePath: /v1schemes: - httpconsumes: - application/jsonproduces: - application/jsonpaths: /pets: get: summary: List all pets operationId: listPets tags: - pets parameters: - name: limit in: query description: How many items to return at one time (max 100) required: false type: integer format: int32 responses: 200: description: An paged array of pets headers: x-next: type: string description: A link to the next page of responses schema: $ref: Pets default: description: unexpected error schema: $ref: Error post: summary: Create a pet operationId: createPets tags: - pets responses: 201: description: Null response default: description: unexpected error schema: $ref: Error /pets/{petId}: get: summary: Info for a specific pet operationId: showPetById tags: - pets parameters: - name: petId in: path description: The id of the pet to retrieve type: string responses: 200: description: Expected response to a valid request schema: $ref: Pets default: description: unexpected error schema: $ref: Errordefinitions: Pet: required: - id - name properties: id: type: integer format: int64 name: type: string tag: type: string Pets: type: array items: $ref: Pet Error: required: - code - message properties: code: type: integer format: int32 message: type: string; line: 1, column: 8]

Samebug tips4

Check if you forgot to set the "data" field inside your request. If you did set it, check if it's being serialized before sending, and if it's being serialized the right way.

You're inputing information in a way the Json Parser can't understand. This page might enlighten you a little: https://goo.gl/g5wrvy


rafaelrafael

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web337

  • via GitHub by wing328
    ,
  • via Unknown by Unknown author,
  • Stack trace

    • com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'swagger': was expecting ('true', 'false' or 'null') at [Source: swagger: "2.0"info: version: 1.0.0 title: Swagger Petstore license: name: MIThost: petstore.swagger.wordnik.combasePath: /v1schemes: - httpconsumes: - application/jsonproduces: - application/jsonpaths: /pets: get: summary: List all pets operationId: listPets tags: - pets parameters: - name: limit in: query description: How many items to return at one time (max 100) required: false type: integer format: int32 responses: 200: description: An paged array of pets headers: x-next: type: string description: A link to the next page of responses schema: $ref: Pets default: description: unexpected error schema: $ref: Error post: summary: Create a pet operationId: createPets tags: - pets responses: 201: description: Null response default: description: unexpected error schema: $ref: Error /pets/{petId}: get: summary: Info for a specific pet operationId: showPetById tags: - pets parameters: - name: petId in: path description: The id of the pet to retrieve type: string responses: 200: description: Expected response to a valid request schema: $ref: Pets default: description: unexpected error schema: $ref: Errordefinitions: Pet: required: - id - name properties: id: type: integer format: int64 name: type: string tag: type: string Pets: type: array items: $ref: Pet Error: required: - code - message properties: code: type: integer format: int32 message: type: string; line: 1, column: 8] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:2300) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1459) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3090) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3036) at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:1818) at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:122) at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:58) at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:34) at com.wordnik.swagger.codegen.Codegen.main(Codegen.java:87)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    109 more bugmates