Chetan, Thanks - this is perfect - I must be thinking thinking of something else.
Do you happen to know off the top of your head if the jcrcontent loader is used for JSON initial-content? Just curious as to what the documentation I found on the Sling site is in referenced to (using the "properties" and "nodes" keys). On Mon, Apr 30, 2012 at 2:41 AM, Chetan Mehrotra <chetan.mehro...@gmail.com> wrote: > Hi David, > > Looking at the JsonReader implementation [1] getType > > protected int getType(String name, Object object) { > if (object instanceof Double || object instanceof Float) { > return PropertyType.DOUBLE; > } else if (object instanceof Number) { > return PropertyType.LONG; > } else if (object instanceof Boolean) { > return PropertyType.BOOLEAN; > } else if (object instanceof String) { > if (name.startsWith(REFERENCE)) return PropertyType.REFERENCE; > if (name.startsWith(PATH)) return PropertyType.PATH; > if (name.startsWith(NAME)) return PropertyType.NAME; > if (name.startsWith(URI)) return PropertyType.URI; > if (jsonDate.matcher((String) object).matches()) return > PropertyType.DATE; > } > > // fall back to default > return PropertyType.UNDEFINED; > } > > It appears that type is inferred from the JSON representation itself. And > in some cases from propetyName prefixes. So keeping {"foo":1} should create > foo of type integer > > Chetan Mehrotra > [1] > http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/JsonReader.java?view=markup > > On Mon, Apr 30, 2012 at 3:57 AM, David G. <davidjgonza...@gmail.com> wrote: > >> Can someone refresh my memory how to specify property types in a JSON >> file used in a Bundle's initial-content? >> >> I could swear i remember reading it on the Sling site, but can't find it >> again -- i swear that sites randomizes its content every few days just so I >> can't find anything on it :) >> >> I tried using the properties key as seen here: >> http://sling.apache.org/site/content-loading-jcrcontentloader.html >> >> "properties": { >> "foo": { >> "value": 1, >> "type": "Long" >> } >> } >> >> >> >> However that just creates >> .../node/properties/foo.value = [String] 1 >> .../node/properties/foo.type = [String] Long >> >> As I would expect. >> >> Thanks >> >> -- >> David Gonzalez >> Sent with Sparrow (http://www.sparrowmailapp.com/?sig) >> >>