I'm trying to use BackendIdConverter
for my entities and repositories.
For those entities with compound primary keys, I'm using JSON encoding/decoding.
The uri is ugly.
{
"_embedded": {
"...": [
{
"id": {
"x": 34,
"y": "B"
},
"_links": {
"self": {
"href": "http://localhost:8080/some/%7B%22x%22:34,%22y%22:%22B%22%7D"
},
...
}
},
...
]
},
...
}
The %7B%22x%22:34,%22y%22:%22B%22%7D
is encoded value of {"x":34,"y":"B"}
.
What is the best(simplest/readable) encoding/decoding method for a POJO, safe for a path segment?