10.02.2013

Delphi XE JSON Update

I recently updated my JSON-Library. Both, IJSONObject and IJSONArray now have methods to check for the type of the nested items.
IJSONObject = interface
['{D00A665F-3CBB-4DDB-8300-FB8020DA564B}']
  .
  .
  .
  function isJSONObject(aKey : string) : boolean;
  function isJSONArray(aKey : string) : boolean;
  function isString(aKey : string) : boolean;
  function isInteger(aKey : string) : boolean;
  function isBoolean(aKey : string) : boolean;
  function isDouble(aKey : string) : boolean;
end;

IJSONArray = interface
['{B120D59A-1D00-469E-97CE-AE2A635A51ED}']
  .
  .
  .
  function isJSONObject(aIndex : integer) : boolean;
  function isJSONArray(aIndex : integer) : boolean;
  function isString(aIndex : integer) : boolean;
  function isInteger(aIndex : integer) : boolean;
  function isBoolean(aIndex : integer) : boolean;
  function isDouble(aIndex : integer) : boolean;
end;

Usage:
var
  jo : IJSONObject;
begin
  jo := TJSON.NewObject('{"string":"abc", "integer":123}');

  jo.isString('string'); // true
  jo.isInteger('integer'); // true
  jo.isBoolean('string'); // false
end;
The implementation is very strict, e.g. isDouble will return false if the value is an integer and could be accessed as a double. I also included unit tests to cover these methods.

tracert -h 60 obiwan.scrye.net

Someone had fun with the routing at Beaglenetworks
Routenverfolgung zu obiwan.scrye.net [216.81.59.173] über maximal 60 Abschnitte:

  7   137 ms   127 ms   127 ms  10gigabitethernet1-2.core1.atl1.he.net [184.105.213.110] 
  8   126 ms   126 ms   127 ms  216.66.0.26 
  9     *        *        *     Zeitberschreitung der Anforderung.
 10   163 ms   165 ms   164 ms  Episode.IV [206.214.251.1] 
 11   193 ms   166 ms   164 ms  A.NEW.HOPE [206.214.251.6] 
 12   169 ms   164 ms   167 ms  It.is.a.period.of.civil.war [206.214.251.9] 
 13   168 ms   164 ms   166 ms  Rebel.spaceships [206.214.251.14] 
 14   169 ms   163 ms   164 ms  striking.from.a.hidden.base [206.214.251.17] 
 15   169 ms   165 ms   165 ms  have.won.their.first.victory [206.214.251.22] 
 16   165 ms   167 ms   165 ms  against.the.evil.Galactic.Empire [206.214.251.25] 
 17   165 ms   164 ms   168 ms  During.the.battle [206.214.251.30] 
 18   166 ms   164 ms   165 ms  Rebel.spies.managed [206.214.251.33] 
 19   166 ms   167 ms   162 ms  to.steal.secret.plans [206.214.251.38] 
 20   166 ms   165 ms   163 ms  to.the.Empires.ultimate.weapon [206.214.251.41] 
 21   165 ms   163 ms   164 ms  the.DEATH.STAR [206.214.251.46] 
 22   168 ms   166 ms   167 ms  an.armored.space.station [206.214.251.49] 
 23   164 ms   169 ms   167 ms  with.enough.power.to [206.214.251.54] 
 24   164 ms   189 ms   168 ms  destroy.an.entire.planet [206.214.251.57] 
 25   170 ms   168 ms   174 ms  Pursued.by.the.Empires [206.214.251.62] 
 26   166 ms   169 ms   167 ms  sinister.agents [206.214.251.65] 
 27   166 ms   163 ms   166 ms  Princess.Leia.races.home [206.214.251.70] 
 28   168 ms   163 ms   163 ms  aboard.her.starship [206.214.251.73] 
 29   168 ms   171 ms   165 ms  custodian.of.the.stolen.plans [206.214.251.78] 
 30   169 ms   172 ms   168 ms  that.can.save.her [206.214.251.81] 
 31   166 ms     *      165 ms  people.and.restore [206.214.251.86] 
 32   168 ms   167 ms   164 ms  freedom.to.the.galaxy [206.214.251.89] 
 33   166 ms   166 ms   164 ms  0-------------------0 [206.214.251.94] 
 34   165 ms   170 ms   166 ms  0------------------0 [206.214.251.97] 
 35   168 ms   170 ms   164 ms  0-----------------0 [206.214.251.102] 
 36   166 ms   169 ms   168 ms  0----------------0 [206.214.251.105] 
 37   167 ms   168 ms   164 ms  0---------------0 [206.214.251.110] 
 38   163 ms   165 ms   165 ms  0--------------0 [206.214.251.113] 
 39   167 ms   171 ms   166 ms  0-------------0 [206.214.251.118] 
 40   167 ms   166 ms   172 ms  0------------0 [206.214.251.121] 
 41   166 ms   165 ms   165 ms  0-----------0 [206.214.251.126] 
 42   172 ms   169 ms   172 ms  0----------0 [206.214.251.129] 
 43   165 ms   168 ms   166 ms  0---------0 [206.214.251.134] 
 44   168 ms   163 ms   168 ms  0--------0 [206.214.251.137] 
 45   166 ms   167 ms   260 ms  0-------0 [206.214.251.142] 
 46   166 ms   164 ms   173 ms  0------0 [206.214.251.145] 
 47   164 ms   167 ms   165 ms  0-----0 [206.214.251.150] 
 48   168 ms   166 ms   168 ms  0----0 [206.214.251.153] 
 49   166 ms   164 ms   168 ms  0---0 [206.214.251.158] 
 50   184 ms   171 ms   169 ms  0--0 [206.214.251.161] 
 51   168 ms   170 ms   168 ms  0-0 [206.214.251.166] 
 52   165 ms   168 ms   169 ms  00 [206.214.251.169] 
 53   172 ms   169 ms   165 ms  I [206.214.251.174] 
 54   171 ms   169 ms   169 ms  By.Ryan.Werber [206.214.251.177] 
 55   171 ms   168 ms   171 ms  When.CCIEs.Get.Bored [206.214.251.182] 
 56   167 ms   168 ms   173 ms  read.more.at.beaglenetworks.net [206.214.251.185] 
 57   179 ms   170 ms   166 ms  FIN [216.81.59.173] 

Ablaufverfolgung beendet.