Content deleted Content added
→JSON: Reply |
→JSON: Reply |
||
Line 19:
:::Thanks Aidan! Can you see why [[Module talk:Data/testcases]] is not working? To get this working in [[Module:Women in Green event]] I had to use <code>tonumber</code> to convert the 1 to a number. (I don't understand why because I used "1" in the JSON file, which should be a string.) It seems this module can only handle keys which are strings. — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 11:23, 5 October 2023 (UTC)
::::The issue here is that the JSON loader is probably automatically converting these to number keys for whatever reason. I've fixed it in this module by going for the numbered key if and only if it has a tonumber evaluation and the string key returns nil, which fixes your testcase. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 11:50, 5 October 2023 (UTC)
:::::Thanks, that looks good — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 12:01, 5 October 2023 (UTC)
|