For a bit of context, I'm trying to make an app to figure out the readings and psalms for the Daily Office from the BCP, and I've formatted everything in YAML for better multi-line string support. However, this also means I have a lot of values that are just a number like 34 and a lot of keys that are dates formatted as MMdd. For example:
'0101':
evening:
psalter: '148'
morning:
psalter: '103'
The data's freeform enough that I'm just loading it into a Map<String?, Any?> with decodeMapFromString, so I can do some post-processing. But despite escaping everything to clearly mark them as strings, it's casting them to numbers. For example, (and ironically using JSON to display the expected results) it's giving me the map:
{
"101": {
"evening": {
"psalter": 148
},
"morning": {
"psalter": 103
}
}
}
not:
{
"0101": {
"evening": {
"psalter": "148"
},
"morning": {
"psalter": "103"
}
}
}
like I expect
For a bit of context, I'm trying to make an app to figure out the readings and psalms for the Daily Office from the BCP, and I've formatted everything in YAML for better multi-line string support. However, this also means I have a lot of values that are just a number like
34and a lot of keys that are dates formatted asMMdd. For example:The data's freeform enough that I'm just loading it into a
Map<String?, Any?>withdecodeMapFromString, so I can do some post-processing. But despite escaping everything to clearly mark them as strings, it's casting them to numbers. For example, (and ironically using JSON to display the expected results) it's giving me the map:not:
like I expect