当前位置:网站首页>Splicing plain text into JSON strings - easy language method
Splicing plain text into JSON strings - easy language method
2022-07-04 06:56:00 【Teng Qingshan】
demand :
Zhang San
Li Si
Wang Wu
Turn such plain text into the following json, It is possible to use any programming language to splice and generate , Put code that is easy to implement in language
{"data":[{"name":" Zhang San "},{"name":" Li Si "},{"name":" Wang Wu "}]}
Code :
. edition 2
. support library spec
. Subroutines Subroutines _ Plain text to json, The text type , , name
. Parameters text, The text type
. local variable arr, The text type , , "0"
. local variable i, Integer type
. local variable line_text, The text type
. local variable result, The text type
arr = Split text (text, # A newline , )
result = “{” + # quotes + “data” + # quotes + “:[”
. Cycle head ( Take the number of array members (arr), i)
line_text = arr [i]
Debug output (line_text)
result = result + “{” + # quotes + “name” + # quotes + “:” + # quotes + line_text + # quotes + “}”
. If it's true ( Take the number of array members (arr) ≠ i)
result = result + “,”
. If it really ends
. Cycle end ()
result = result + “]}”
return (result)
边栏推荐
- Variables d'environnement personnalisées uniapp
- MySQL 45 lecture learning notes (VII) line lock
- Bottom problem of figure
- Mysql 45讲学习笔记(十三)表数据删掉一半,表文件大小不变
- Uniapp custom environment variables
- Check and display one column in the known table column
- Background and current situation of domestic CDN acceleration
- 关于IDEA如何设置快捷键集
- 2022年,或許是未來10年經濟最好的一年,2022年你畢業了嗎?畢業後是怎麼計劃的?
- tars源码分析之5
猜你喜欢
云Redis 有什么用? 云redis怎么用?
P26-P34 third_ template
Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction
The important role of host reinforcement concept in medical industry
[Valentine's day] - you can change your love and write down your lover's name
颈椎、脚气
notepad++如何统计单词数量
[number theory] fast power (Euler power)
Variables d'environnement personnalisées uniapp
NLP-文献阅读总结
随机推荐
Design of test cases
Lottery system test report
tars源码分析之9
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
Tar source code analysis Part 10
js 常用时间处理函数
Tar source code analysis Part 2
About how idea sets up shortcut key sets
The cloud native programming challenge ended, and Alibaba cloud launched the first white paper on application liveliness technology in the field of cloud native
uniapp小程序分包
MySQL 45 lecture learning notes (VII) line lock
Mobile adaptation: vw/vh
MySQL relearn 2- Alibaba cloud server CentOS installation mysql8.0
Su Weijie, a member of Qingyuan Association and an assistant professor at the University of Pennsylvania, won the first Siam Youth Award for data science, focusing on privacy data protection, etc
Mysql 45讲学习笔记(十二)MySQL会“抖”一下
MySQL 45 lecture learning notes (VI) global lock
Variables d'environnement personnalisées uniapp
【GF(q)+LDPC】基于二值图GF(q)域的规则LDPC编译码设计与matlab仿真
How does the inner roll break?