Update to latest jsonld.js.
--- a/playground/jsonld.js Wed Jan 11 21:53:12 2012 -0500
+++ b/playground/jsonld.js Wed Jan 11 22:13:11 2012 -0500
@@ -500,7 +500,7 @@
rval = {'@context': ctxOut};
if(out.constructor === Array)
{
- rval['@id'] = out;
+ rval[_getKeywords(ctxOut)['@id']] = out;
}
else
{
@@ -3066,36 +3066,6 @@
{
rval = jsonld.compact(ctx, rval);
}
-/*
- // preserve top-level array
- if(isArray && rval.constructor !== Array)
- {
- ctx = rval['@context'];
- var idKeyword = '@id';
- for(var key in ctx)
- {
- if(ctx[key] === '@id')
- {
- idKeyword = key;
- }
- }
- var arr = rval['@id'];
- rval = [];
- for(var i in arr)
- {
- // make '@context' first key
- var value = {
- '@context': ctx,
- };
- var keys = Object.keys(arr[i]);
- for(var k in keys)
- {
- var key = keys[k];
- value[key] = arr[i][key];
- }
- rval.push(value);
- }
- }*/
}
return rval;