Allow use of `java.nio.file.Path` for `readValue()`, `writeValue()`
See original GitHub issueVersion 2.9.5
There is no out of box method to read from Path
and write to Path
, it will be usefull to make these methods.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:17 (10 by maintainers)
Top Results From Across the Web
How does Jackson automatically deserialize java.nio.file.Path?
Now a simple test shows that it works: ObjectMapper mapper = new ObjectMapper(); ExampleClass exampleClass = mapper. readValue(json, ...
Read more >Jackson JSON Java Parser API Example Tutorial - DigitalOcean
To use Jackson JSON Java API in our project, we can add it to the project ... readValue() and writeValue() methods to transform...
Read more >Understanding insecure implementation of Jackson ...
Now, the ObjectMapper class uses the function readValue to read a json data and parse it to java objects. In the above code,...
Read more >Jackson ObjectMapper - Jenkov.com
The Jackson ObjectMapper can read JSON into Java objects and write ... of readValue() is the source of the JSON (string, stream or...
Read more >Path (Java Platform SE 8 ) - Oracle Help Center
Returns the name of the file or directory denoted by this path as a Path object. FileSystem · getFileSystem(). Returns the file system...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ideally the new methods would not use
Path#toFile()
because that method throwsUnsupportedOperationException
if the path is not on the default file system. Examples of non-default file systems include zip file systems and in-memory file systems.I maintain an application that uses Jackson to interact with both of those types of file systems. If you added methods that accept
Path
objects but invoketoFile()
on them, I wouldn’t be able to use any of those methods.I’d think it would be better if the
Path
-accepting methods delegate to{Input,Output}Stream
-accepting ones. For example:I’ve started with 3.0 and added pull requests for jackson-core and jackson-databind.
I’m unsure about adding it to 2.13, though. It would be a half-heartedly support for
Path
after the JDK has the nio-package (“new” IO) for ten years now. This issue had the 3.0-label three years and it still can be 3.0. 😏But if you say so I’ll add it “workaround-ish” to 2.13.