diff options
author | pommicket <pommicket@gmail.com> | 2022-12-30 18:59:39 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-30 18:59:39 -0500 |
commit | 1bd19da6910c85029c34c6d8cf65739a9e0a2127 (patch) | |
tree | 23896f33125315499f51dd1ac4a49632e2afe11f /lsp-json.c | |
parent | 72624969e99d284984614a33cabb4ed9fea31a0a (diff) |
start parse rename response
Diffstat (limited to 'lsp-json.c')
-rw-r--r-- | lsp-json.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -465,6 +465,20 @@ JSONValue json_array_get(const JSON *json, JSONArray array, u64 i) { return (JSONValue){0}; } +// returns the `i`th key in `object`. +JSONValue json_object_key(const JSON *json, JSONObject object, u64 i) { + if (i < object.len) + return json->values[object.items + i]; + return (JSONValue){0}; +} + +// returns the `i`th value in `object`. +JSONValue json_object_value(const JSON *json, JSONObject object, u64 i) { + if (i < object.len) + return json->values[object.items + object.len + i]; + return (JSONValue){0}; +} + // returns NaN if `x` is not a number (ha ha). double json_force_number(JSONValue x) { if (x.type == JSON_NUMBER) { |