@Test
  @Parameters({"true", "false"})
  public void simpleObjectAsStringParsesWithIdentityField(String usePdxInstanceSortedHelper) {
    System.setProperty(JSONFormatter.SORT_JSON_FIELD_NAMES_PROPERTY, usePdxInstanceSortedHelper);
    String identityField = "a";
    String nonIdentityField = "b";
    String nonExistentField = "c";
    String jsonObjectString = "{\"a\":2,\"b\":3}";

    PdxInstance pdxInstance = JSONFormatter.fromJSON(jsonObjectString, identityField);
    String deserializedJsonObjectString = JSONFormatter.toJSON(pdxInstance);

    assertThat(pdxInstance.isIdentityField(identityField)).isTrue();
    assertThat(pdxInstance.isIdentityField(nonIdentityField)).isFalse();
    assertThat(pdxInstance.isIdentityField(nonExistentField)).isFalse();
    assertThat(pdxInstance.hasField(identityField)).isTrue();
    assertThat(pdxInstance.hasField(nonIdentityField)).isTrue();
    assertThat(pdxInstance.hasField(nonExistentField)).isFalse();
    assertThat(deserializedJsonObjectString).isEqualTo(jsonObjectString);
  }
A test class to document and make clear what JSONFormatter will and won't parse as far as simple
examples.
geode-core/src/integrationTest/java/org/apache/geode/pdx/JSONFormatterBasicJUnitTest.java