-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spaces in field name causes Exception #1623
Comments
I have a similar issue with properties that have a question mark in them :) |
There are some characters that need to be escaped because they can the way that JSON Pointer is resolved. The next release (1.2.2) will fix question marks. For the change that was needed, see #1522. @solsticesurfer What version of jsonschema2pojo are you using? Spaces in the property name should work. If you can provide a minimal snippet of JSON Schema that fails, that would be good. |
@joelittlejohn spaces in property names work for JSON Schema but fail with regular json, ie. generating pojo's from following json fails: {
"a b": "text"
} whilst everything is OK with json schema: {
"type" : "object",
"properties" : {
"a b" : {
"type" : "string"
}
}
} |
@joelittlejohn Appreciate the help and thank you. This is using version 1.2.1 via Gradle. This JSON sample below is enough to reproduce the behavior. As @unkish pointed out, the conversion fails when calling Unfortunately, the schema is not known before processing and is not constant, so using json schema is not an option. I do see that the field with the underscores is successfully interpreted and that the result has the underscores removed. If we had the ability to specify a substitution rule to use in a case like this, it would resolve the problem.
|
Is there any plans to fix this..? The many different types of json files, each has several fields with spaces in it, and would be awesome if this could be fixed...? Tkx! |
Eventually. |
When parsing a json file that has spaces in the field names, the following is thrown:
java.lang.IllegalArgumentException: Path not present:
. It's then followed by the URL-encoded version of the property name (e.g. "My%20Property"). Unfortunately, I don't have control over the source and design of the payload.I've scoured through the documentation, issues, and source but haven't found a solution. I thought this might be covered under
propertyWordDelimiters
but that doesn't seem to be the case.Ideally, I would like to either remove the space in a property name or replace it with another valid character.
Is this possible or is there a better approach to dealing with this scenario?
The text was updated successfully, but these errors were encountered: