Plenty of times I’ve run into logging Python
dict and needing to convert them to JSON for whatever reason. Have run into this across numerous projects and working with a variety of people who have stumbled into the same issue.
What needs to change exactly?
" -> \" ' -> " True -> true False -> false None -> null
Save your data into
sed it up.
echo -e "\n" && sed 's/"/\\"/g; s/'\''/\"/g; s/True/true/g; s/False/false/g; s/None/null/g' file.txt && echo -e "\n"
If you’d prefer to have the json in a file:
sed 's/"/\\"/g; s/'\''/\"/g; s/True/true/g; s/False/false/g; s/None/null/g' file.txt > file.json
A common question after this would be “Can I have it automatically get filled without copying?” - yes you can! A thread on how to send stdout to clipboard . Takeway:
In the future it would be nice to be able to paste directly and pipe through
sed and have the output end up back in my clipboard, but that will have to wait for another day.
The utility of Python Flask routing on a Lambda, without the framework.
Emoji cursors changing based on position? Oh my.
Let users read a random page on your site. A quick guide on how to add this feature to your site in no time.