Update Python requests codegen

This commit is contained in:
Ankit Mahato
2024-03-12 01:52:24 +05:30
parent e517e9d919
commit e8fd13cbce
4 changed files with 331 additions and 127 deletions

View File

@ -0,0 +1,15 @@
String jsonToPyDict(String jsonString) {
Map<String, String> replaceWithMap = {
"null": "None",
"true": "True",
"false": "False"
};
String pyDict = jsonString;
for (var k in replaceWithMap.keys) {
RegExp regExp = RegExp(k + r'(?=([^"]*"[^"]*")*[^"]*$)');
pyDict = pyDict.replaceAllMapped(regExp, (match) {
return replaceWithMap[match.group(0)] ?? match.group(0)!;
});
}
return pyDict;
}