keys

Get all the keys from your Json object

version(Have_vibe_d_data)
@trusted
string[]
keys
(
Json obj
,
const string file = __FILE__
,
const size_t line = __LINE__
)

Examples

Empty Json object keys

Json.emptyObject.keys.length.should.equal(0);

Json object keys

auto obj = Json.emptyObject;
obj["key1"] = 1;
obj["key2"] = 3;

obj.keys.should.containOnly(["key1", "key2"]);

Json array keys

auto obj = Json.emptyArray;

({
  obj.keys.should.contain(["key1", "key2"]);
}).should.throwAnyException.msg.should.startWith("Invalid Json type.");

Meta