Raj kumar Mishra
Raj kumar Mishra

Reputation: 21

Json parse exception while setting mocks in wiremock

I have the following JSON using as a mock-to-wire mock server. After including this JSON file, on wire mock server start, I am getting the following error

{ "scenarioName": "Retry Scenario", "requiredScenarioState": "Authorized", "newScenarioState": "Started", "id": "28d9932d-20a9-41f1-a05b-2e080029f914", "request": { "urlPathPattern": "/api/Application/Q835YUDX/started", "method": "GET" }, "response": { "status": 200, "headers": { "Connection": "close" }, "transformers": [ "response-template" ] }, "uuid": "28d9932d-20a9-41f1-a05b-2e080029f914" }

Picked up _JAVA_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=2 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" wiremock.com.fasterxml.jackson.core.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: { "scenarioName": "Retry Scenario", "requiredScenarioState": "Authorized", "newScenarioState": "Started", "id": "28d9932d-20a9-41f1-a05b-2e080029f914", "request": { "urlPathPattern": "/api/Application/Q835YUDX/started", "method": "GET" }, "response": { "status": 200, "headers": { "Connection": "close" }, "transformers": [ "response-template" ] }, "uuid": "28d9932d-20a9-41f1-a05b-2e080029f914" } ; line: 1, column: 2] at wiremock.com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702) at wiremock.com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)

Upvotes: 1

Views: 1137

Answers (1)

Wojtek
Wojtek

Reputation: 1530

0xFEFF is a "ZERO WIDTH NO-BREAK SPACE", why would you need it in your JSON file?

Just replace that space with normal space 0x0020.

Upvotes: 1

Related Questions