private JsonArray readArray() { read(); JsonArray array = new JsonArray(); skipWhiteSpace(); if (readChar(']')) { return(array); } do { skipWhiteSpace(); array.add(readValue()); skipWhiteSpace(); } while (readChar(',')); if (!readChar(']')) { throw expected("',' or ']'"); } return(array); }
/// <summary> /// Save the reference. /// </summary> /// <param name="summary">The summary</param> public void save(string summary) { if (this.statement.id == null) { throw new Exception("The statement has no Id. Please save the statement containing it first."); } JsonObject obj = new JsonObject(); foreach (KeyValuePair<string, Dictionary<string, Snak>> pair in this.snaks) { JsonArray array = new JsonArray(); foreach(KeyValuePair<string, Snak> p in pair.Value) { array.add(p.Value.toArray()); } obj.add(pair.Key, array); } JsonObject result = this.statement.entity.api.setReference(this.statement.id, obj, this.hash, this.statement.entity.lastRevisionId, summary); this.updateDataFromResult(result); }
private JsonArray readArray() { read(); JsonArray array = new JsonArray(); skipWhiteSpace(); if (readChar(']')) { return array; } do { skipWhiteSpace(); array.add(readValue()); skipWhiteSpace(); } while (readChar(',')); if (!readChar(']')) { throw expected("',' or ']'"); } return array; }