Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
see original conversation:
http://jackson-users.ning.com/forum/topics/nested-json-via-url-references
use case:
1) there is a need to store multiple related configurations in terracotta server
http://code.google.com/p/terrastore/
which is a clustered json document store
2) for example, this url would return full configurations:
http://server/configurations/conf_01
http://server/configurations/conf_02
3) and this url would return components of full configs:
http://server/components/comp_01
http://server/components/comp_02
http://server/components/comp_03
4) the idea is that full configurations can refer to the components like this:
conf_01.json:
{
// in this case the component definition is embedded in the parent file
compA :
// and now component refers to external resource:
compB : http://server/components/comp_02
}
conf_02.json:
// both subcomponents are ferfferring to the external components resources
5) suggested basic logic: this is what comes to mind:
a) if the target java field type is string - do not try to dereference;
i.e. for:
class Test
{ String field; }test1.json { field : this-any-string }
and
test2.json { field : http://this-looks-like-url }
will just produce string
b) if the target java field type is NOT string - DO dereference;
class Test { Address address; }
class Address { String field; }
// this is doing normal de-serialization
test1.json
{ address :
}
test2.json
{ address : file://./external-resource.json }c) too bad string properties can not be url-ed; may be there is way for that?
6) probably has to treat "basedir" or "./" specially, like in http references,
relative to the location of the current document. to avoid absolut urls and enforce
for example that config stays on the same server / in the same folder;
7) may be there is an "official markup" in json for this kind of thing?
or some js libraries like jquery do this in some kind of "standard way"?
I can not imagine I am the first to ask for this ![]()
and of course next natural idea which comes to mind is provide json inheritance, like maven pom.xml which has a parent, etc.
come on, if you serializing classes, then json docs also have inherit!