Skip to content

float[] and double[] are serialized to JSON as { } #196

@lukehutch

Description

@lukehutch

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

float[] and double[] are serialized to JSON as { }.

Version Information

jackson-jr-objects 2.18.3

Reproduction

The following code:

var values = new LinkedHashMap<String, Object>();
values.put("intArray", new int[] { 1, 2, 3 });
values.put("longArray", new long[] { 1L, 2L, 3L });
values.put("floatArray", new float[] { 1.0f, 2.0f, 3.0f });
values.put("doubleArray", new double[] { 1.0, 2.0, 3.0 });
System.out.println(JSON.std.with(JSON.Feature.PRETTY_PRINT_OUTPUT).asString(values));

prints:

{
  "intArray" : [ 1, 2, 3 ],
  "longArray" : [ 1, 2, 3 ],
  "floatArray" : { },
  "doubleArray" : { }
}

Expected behavior

{
  "intArray" : [ 1, 2, 3 ],
  "longArray" : [ 1, 2, 3 ],
  "floatArray" : [ 1.0, 2.0, 3.0 ],
  "doubleArray" : [ 1.0, 2.0, 3.0 ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    pr-welcomeIssue for which progress most likely if someone submits a Pull Request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions