10000 其实识别一个Json是否为合法的很简单的。 · Issue #8 · cyq1162/cyqdata · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

其实识别一个Json是否为合法的很简单的。 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xieguiproject opened this issue Mar 31, 2017 · 1 comment
Open

其实识别一个Json是否为合法的很简单的。 #8

xieguiproject opened this issue Mar 31, 2017 · 1 comment

Comments

@xieguiproject
Copy link

其实识别一个Json是否为合法的很简单的,利用栈的思想就可以了,例如:{“temp”:["id":“012”,“value”:"123"]}这个Json首先将第一个{入栈,然后判断下一个字符和栈顶是否相等,如果不相等且是[、]、{、}、这类符号,那么久继续入栈,然后接着判断是否和栈顶相等,如果相等,且是前面说的那些字符,就进行出栈操作,最后字符串判断完,就检查栈是否为空,如果不为空则Json字符串不合法

@kekewf
Copy link
kekewf commented Aug 22, 2022

有可能,只是不懂栈是啥意思,有个图描述一下就好了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0