I have a function that processes a data structure parsed from JSON. Internally the function is using Reflect.fields() to scan the data structure.
I'm also creating a second function that returns a data structure that can be directly passed into the first function.
This is working for types like strings and arrays, but is not working for dictionaries. Map<K, V> is what I've been using in my code and seems like the most natural way to construct such a dictionary, but the output does not match the format of JSON.parse() (It has its "h" property with dollar signs in the keys).
How can I dynamically generate an object filled with key/value pairs that is similar to the output from JSON.parse? (Is there a clean, efficient way to convert Map to such a format?)
JavaScript is my current target for this code though it will eventually be compiled to other targets as well.