<commit_before>## API Methods


### Android

    Realm.createObjectFromJson(Class realmObject, JSONObject json)
    Realm.createAllFromJson(Class realmObject, JSONArray json)

    Realm.createObjectFromJson(Class realmObject, InputStream json);
    Realm.createAllFromJson(Class realmObject, InputStream json);


### Java

*Not implemented yet*


## Notes about the JSON API


- Import using InputStream only works for API 11+. Methods are annotated as such.

- JSON property names need to match java variabel names.

- Import API does not work in standard Java. JSON is only supported from Java 7, and with a
  different API.

- If import fails, everything up to that point is put in the database (if Realm.commitTransaction()
  is called). We need a Realm.cancelWriteTransaction() to change this behavior.

- createObject() returns the created Object, createAll() doesn't. Returning it matches the current
  API, but not being able to for Arrays is annoying. Does it make sense to return created object
  anyway? As it is already filled.

- Currently two methods are added to RealmObject: populateUsingJsonObject() and
  populateUsingJsonStream(). They are overridden in the proxy objects with the proper
  implementations. It would perhaps be better to move these to a separate class, but then it makes
  it harder to hook it into the Realm object.


### Enhancements

- adding Realm.rollback() or Realm.cancelWriteTransaction() will make it possible to abort a faulty
  import.

- Java 6 does not have Json parsing capabilities. We need to add them ourselves. Perhaps using GSON.

- Realm.createOrUpdateFromJson() would be a natural extension but requires primary key support.

- Consider adding mapping annotations between Json and Java, but is this a Realm responsibility?

<commit_msg>Added note about dates.<commit_after>## API Methods


### Android

    Realm.createObjectFromJson(Class realmObject, JSONObject json)
    Realm.createAllFromJson(Class realmObject, JSONArray json)

    Realm.createObjectFromJson(Class realmObject, InputStream json);
    Realm.createAllFromJson(Class realmObject, InputStream json);


### Java

*Not implemented yet*


## Notes about the JSON API


- Import using InputStream only works for API 11+. Methods are annotated as such.

- JSON property names need to match java variabel names.

- Import API does not work in standard Java. JSON is only supported from Java 7, and with a
  different API.

- If import fails, everything up to that point is put in the database (if Realm.commitTransaction()
  is called). We need a Realm.cancelWriteTransaction() to change this behavior.

- createObject() returns the created Object, createAll() doesn't. Returning it matches the current
  API, but not being able to for Arrays is annoying. Does it make sense to return created object
  anyway? As it is already filled.

- Currently two methods are added to RealmObject: populateUsingJsonObject() and
  populateUsingJsonStream(). They are overridden in the proxy objects with the proper
  implementations. It would perhaps be better to move these to a separate class, but then it makes
  it harder to hook it into the Realm object.


### Enhancements

- adding Realm.rollback() or Realm.cancelWriteTransaction() will make it possible to abort a faulty
  import.

- Java 6 does not have Json parsing capabilities. We need to add them ourselves. Perhaps using GSON.

- Realm.createOrUpdateFromJson() would be a natural extension but requires primary key support.

- Consider adding mapping annotations between Json and Java, but is this a Realm responsibility?

- Consider which date representations we should support. There exist a multitude of options.

{'fraction_non_alphanumeric': 0.05532953620829943, 'fraction_numerical': 0.0021697857336588013, 'mean_word_length': 4.253561253561253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5057584', 'n_tokens_mistral': 960, 'n_tokens_neox': 916, 'n_words': 484}