TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Pretty print invalid JSON (or anything that looks sort of like JSON)

9 点作者 jastr超过 3 年前

4 条评论

savy91超过 3 年前
It doesn&#x27;t work too well wish some actual valid jsons:<p>Input:<p>{&quot;somekey&quot;: &quot;value&quot;, &quot;someother&quot;: &quot;value,value,value&quot;}<p>Output:<p>{<p><pre><code> &quot;somekey&quot;: &quot;value&quot;, &quot;someother&quot;: &quot;value, value, value&quot; </code></pre> }<p>Seems like the problem is with commas being converted to ,\n regardelss of them being inside a valid string.
shmoogy超过 3 年前
Saving this for later - was going to try to make something like this for when I get invalid json and have to spend a bit figuring out what is wrong.<p>Thanks
jastr超过 3 年前
Hi HN! This was a python script I used on the command line for a while, before spending a weekend converting it to a microsite.<p>Pretty print json with single quotes or None or anything that looks like json, like python dictionaries&#x2F;arrays or anything that PHP can spit out.
eduardosasso超过 3 年前
Good idea. Suggestion add some examples there so people can see what it looks like when you have broken data.