added enum indexed array support to json (#16807)

* added enum indexed array support to json

* Added json test

* Removed when statement for enum indexed arrays
This commit is contained in:
Jason Beetham 2021-01-25 16:55:49 -07:00 • committed by GitHub
commit dde096ffde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -1103,7 +1103,7 @@ when defined(nimFixedForwardGeneric):
jsonPath.add '['
jsonPath.addInt i
jsonPath.add ']'
initFromJson(dst[i], jsonNode[i], jsonPath)
initFromJson(dst[i.S], jsonNode[i], jsonPath) # `.S` for enum indexed arrays
jsonPath.setLen originalJsonPathLen
proc initFromJson[T](dst: var Table[string,T]; jsonNode: JsonNode; jsonPath: var string) =