Hi there,

consider the following simple use case:

  import std.json;
  float[] floats = [1,2,3];
  JSONValue j = "{}".parseJSON;
  j.object["floats"] = floats;
  std.file.write("test.json", j.toString);
  JSONValue jj = readText("test.json").parseJSON;
  jj.object["floats"].array[1].floating.writeln;

It is expected to print '2' in the console, however an exception is thrown:

std.json.JSONException@/build/ldc-I3nwWj/ldc-0.17.1/runtime/phobos/std/json.d(235):
 JSONValue is not a floating type

while the below works fine:

  import std.json;
  float[] floats = [1,2,3];
  JSONValue j = "{}".parseJSON;
  j.object["floats"] = floats;
  j.object["floats"].array[1].floating.writeln;

any pointers to what could be going wrong?

Reply via email to