Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
vane112844y@SortOfTested typescript Map is javascript es6 Map and coming from java for me variable Map<string, string> is no different then object {‘foo’:’bar’} that is serializable by JSON.stringify cause json allows only strings as objects.
https://stackoverflow.com/questions... -
vane112844y@AlgoRythm yeah but to get datetime from string you need to provide custom serializer cause json specification doesn’t recognize date
-
@vane
Yeah, no way around that. You can't deserialize to a typescript map. Under the hood it's just an array[[k,v]].
You can use a reviver in json.parse however, scan the symbol and do a transformation.
https://developer.mozilla.org/en-US...
Or type it as {[key: string]: string}. Different semantics, but same result.
Related Rants
Converting javascript/ typescript Map to json
or python date to json
or anything complicated to json is mostly ending with implementing serialization patterns
With date it’s so annoying cause we have iso standards that every language implemented or have libraries
so typescript doesn’t recognize Map<string, string> so you have to convert it to array and then to object
with python you need to make your own serializer / deserializer
So much waste of power usage that if only Greta know it she would say ‘how dare you!’
It can stop global warming.
rant
wk229
conversion
json