After I record, I used variable and run.
Body data:
{
"data: [
{
"gsVersion":"1.0",
"stepCode":"${stepCode}",
"stepName":"${stepName}",
"familyId":"${familyId}",
"listGeoEventAddOfStep": [
{
"id":0,
"geoEventCode":"${geoEventCode}",
"name":"${geoEventName}")},
"description":"${geoEventDes}"
}
]
}
]
}
However, it gave the response:
{
"timestamp":1514976739620,
"status":400,
"error":"Bad Request",
"exception":"org.springframework.http.converter.HttpMessageNotReadableException",
"message":"Could not read document: Unexpected character (')' (code 41)): was expecting comma to separate Object entries\n at [Source: java.io.PushbackInputStream#4fa24716; line: 1, column: 175]\n at [Source: java.io.PushbackInputStream#4fa24716; line: 1, column: 150] (through reference chain: com.geopost.controller.requestbody.RequestBodyList[\"data\"]->java.util.ArrayList[0]->com.geopost.dto.GeoStepAddDTO[\"listGeoEventAddOfStep\"]->java.util.ArrayList[0]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Unexpected character (')' (code 41)): was expecting comma to separate Object entries\n at [Source: java.io.PushbackInputStream#4fa24716; line: 1, column: 175]\n at [Source: java.io.PushbackInputStream#4fa24716; line: 1, column: 150] (through reference chain: com.geopost.controller.requestbody.RequestBodyList[\"data\"]->java.util.ArrayList[0]->com.geopost.dto.GeoStepAddDTO[\"listGeoEventAddOfStep\"]->java.util.ArrayList[0])",
"path":"/rest/steps"
}
Extracting the exception message for more clarity:
Could not read document: Unexpected character (')' (code 41)):
was expecting comma to separate Object entries
at [Source: java.io.PushbackInputStream#4fa24716; line: 1, column: 175]
at [Source: java.io.PushbackInputStream#4fa24716; line: 1, column: 150]
(through reference chain: com.geopost.controller.requestbody.RequestBodyList["data"]
->java.util.ArrayList[0]->com.geopost.dto.GeoStepAddDTO["listGeoEventAddOfStep"]
->java.util.ArrayList[0]);
nested exception is com.fasterxml.jackson.databind.JsonMappingException:
Unexpected character (')' (code 41)):
was expecting comma to separate Object entries
at [Source: java.io.PushbackInputStream#4fa24716; line: 1, column: 175]
at [Source: java.io.PushbackInputStream#4fa24716; line: 1, column: 150]
(through reference chain: com.geopost.controller.requestbody.RequestBodyList["data"]
->java.util.ArrayList[0]
->com.geopost.dto.GeoStepAddDTO["listGeoEventAddOfStep"]
->java.util.ArrayList[0])
How do I fix this?
you JSON is invalid, you have for example irrelevant ) sign, a valid JSON can be:
{"data":[{"gsVersion":"1.0","stepCode":"${stepCode}","stepName":"${stepName}","familyId":"${familyId}","listGeoEventAddOfStep":[{"id":0,"geoEventCode":"${geoEventCode}","name":"${geoEventName}"}],"description":"${geoEventDes}"}]}
you can check your json online.
Related
When I send POST request that body request contains some special character like ß, actually it is a character in German like "Zentrale Bußgeldstelle". And bellow is the information of request I sent by using curl run on Gitbash:
curl --location --request POST 'http://localhost:8080/user/v1/register' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "ßtest",
"password": "P#ssword"
}'
And I got the bad request status as below:
{
"timestamp":"2020-06-27T05:22:50.676+0000",
"status":400,
"error":"Bad Request",
"message":"JSON parse error: Invalid UTF-8 middle byte 0x74\n at [Source: (PushbackInputStream);
line: 1, column: 18]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Invalid UTF-8 middle byte 0x74\n at [Source: (PushbackInputStream); line: 1, column: 18]\n at [Source: (PushbackInputStream); line: 1, column: 15] (through reference chain: com.example.springlogin.dto.UserDto[\"username\"])",
"path":"/user/v1/register"
}
I faced that it related to ß character. But the issue not occur when I send that request using postman.I used Springboot to implement that api.
So anyone can help to solve my above issue. Thanks in advance
I am trying to pass variable (repoName) with the repo name to the promotionConfig parameter targetRepo and sourceRepo but I get this error in Jenkins:
Build result notified
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
at [Source: N/A; line: -1, column: -1] (through reference chain: org.jfrog.hudson.pipeline.types.PromotionConfig["targetRepo"])
I am using inside the promotionConfig:
...
'targetRepo' : '${repoName}-release-local',
...
'sourceRepo' : '${repoName}-snapshot-local',
...
The variable repoName
echo "Repo name is ${repoName}"
Output: Repo name is test-repo
Anyone know the right way to pass a variable to the promotionConfig?
You should use double quotes to pass variables inside string.
def var = "${repoName}".toString()
...
'targetRepo' : "" + var + "-release-local",
...
'sourceRepo' : "" + var + "-snapshot-local",
...
I am using OAuth2 with Spring Security.
My authentication manager configures client via database: clients.jdbc(dataSource());
Everything works, but when requesting a token, I get an exception:
2017-04-28 11:14:39.656 WARN 1200 --- [io-8096-exec-10] o.s.s.o.p.c.JdbcClientDetailsService : Could not decode JSON for additional information: BaseClientDetails [clientId=myclientid, clientSecret=mysecret, scope=[myscope], resourceIds=[], authorizedGrantTypes=[authorization_code, refresh_token], registeredRedirectUris=null, authorities=[], accessTokenValiditySeconds=36000, refreshTokenValiditySeconds=36000, additionalInformation={}]
with trace:
org.codehaus.jackson.JsonParseException: Unexpected character ('a' (code 97)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: java.io.StringReader#557a138f; line: 1, column: 2]
...
...
where the column additional_information (varchar(4096)) in table client_details is "asdf" for this entry.
I also tried to change the type of additional_information from String to Map<String, Object> and inserting a string by putting and getting it into the map with the key 'info'. After this, I get the same error, with different trace:
org.codehaus.jackson.JsonParseException: Unrecognized token 'asdf': was expecting at [Source: java.io.StringReader#3e8a7a77; line: 1, column: 21]
...
...
How can I include additional_information into my token?
I have the following type of json file:
{"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}
I am trying to execute the following pig script to load json data
A = load 'pigdemo/employeejson.json' using JsonLoader ('employees:{(firstName:chararray)},{(lastName:chararray)}');
getting error!!
Unable to recreate exception from backed error: Error:
org.codehaus.jackson.JsonParseException: Unexpected end-of-input:
expected close marker for ARRAY (from [Source:
java.io.ByteArrayInputStream#1553f9b2; line: 1, column: 1]) at
[Source: java.io.ByteArrayInputStream#1553f9b2; line: 1, column: 29]
First the reason that you see Unexpected end-of-input is because each recode should be in 1 line - like this :
{"employees":[{"firstName":"John", "lastName":"Doe"}, {"firstName":"Anna", "lastName":"Smith"}, {"firstName":"Peter", "lastName":"Jones"}]}
Now - since each row is employees list run the next command
A = load '$flurryData' using JsonLoader ('employees:bag {t:tuple(firstName:chararray, lastName:chararray)}');
describe A;
dump A;
Give the next output
A: {employees: {t: (firstName: chararray,lastName: chararray)}}
({(John,Doe),(Anna,Smith),(Peter,Jones)})
Hope this help !
I’m trying to use rect output with perform action command.
For example:
query("* text:’Hello’", :y)
[
[0] 226.0
]
Trying:
perform_action('long_press_coordinate',200,y)
And getting the error:
RuntimeError: Action 'long_press_coordinate' unsuccessful: Can not deserialize instance of java.lang.String[] out of END_OBJECT token
at [Source: java.io.StringReader#412a8480; line: 1, column: 61] (through reference chain: sh.calaba.instrumentationbackend.Command["arguments"])
Is it a syntax issue that I’m dealing with or is it much more?
How do I ‘’turn’ the y value to a regular number?
I found code that works:
y=query("* text:’Hello’", :y)
perform_action('long_press_coordinate',200,y[0])
Hope it is helping.