Comments (3)
Version AJ 93v-1203-g8d977fd3
There are more strange in read -m json. Make same read twice. Result is different. 1st reading works almost everytime ... but second reading some reading error. zakukai foo problem is also interesting.
Unset json variable not helps.
nvtree.c has some parsing problem ?
print "========================================================="
read -m json some <<EOF
{
"squanchy" : "cromulent",
"num" : 1,
"text": "foo",
"notbool": "true",
"bool": true ,
"endval" : "yes"
}
EOF
print "-------------------------------"
print -j some
print "-------------------------------"
print $some
print "-------------------------------"
printf "%(json)B\n" some
print "-------------------------------"
printf "%(json)q\n" $some
print "-------------------------------"
printf "%#(csv)q\n" $some
print "-------------------------------"
printf "%(csv)B\n" some
print "========================================================="
read -m json some <<EOF
{
"squanchy" : "cromulent",
"num" : 1,
"text": "foo",
"notbool": "true",
"bool": true ,
"endval" : "yes"
}
EOF
print "-------------------------------"
print -j some
print "-------------------------------"
print $some
print "-------------------------------"
printf "%(json)B\n" some
print "-------------------------------"
printf "%(json)q\n" $some
print "-------------------------------"
printf "%#(csv)q\n" $some
print "-------------------------------"
printf "%(csv)B\n" some
And output is
=========================================================
-------------------------------
{
"bool": true,
"endval": "yes",
"notbool": "true",
"num": 1,
"squanchy": "cromulent",
"text": "foo"
}
-------------------------------
( _Bool bool=true endval=yes notbool=true typeset -l -E num=1 squanchy=cromulent text=foo )
-------------------------------
{
"bool": true,
"endval": "yes",
"notbool": "true",
"num": 1,
"squanchy": "cromulent",
"text": "foo"
}
-------------------------------
'('
_Bool
bool=true
endval=yes
notbool=true
typeset
-l
-E
num=1
squanchy=cromulent
text=foo
')'
-------------------------------
"("
_Bool
"bool=true"
"endval=yes"
"notbool=true"
typeset
"-l"
"-E"
"num=1"
"squanchy=cromulent"
"text=foo"
")"
-------------------------------
(
_Bool bool=true
endval=yes
notbool=true
typeset -l -E num=1
squanchy=cromulent
text=foo
)
=========================================================
json5.sh[31]: read: line 48: ": not found
-------------------------------
{
}
-------------------------------
( )
-------------------------------
{
}
-------------------------------
'('
')'
-------------------------------
"("
")"
-------------------------------
(
)
Previosly next example didn't work, but in this version it works fine
read -m json person <<EOF
{
"first" : "My",
"last" : "Name",
"email" : "[email protected]",
"lucky" : 13,
"quarter" : 0.25,
"empty" : null,
"nerd" : true,
"lotto" : [ 9, 12, 17, 38, 45, 46 ],
"children" : [ "boy", "girl" ]
}
EOF
print "-------------------------------"
print "$person"
print "-------------------------------"
print -r "$person"
print "-------------------------------"
print ${person.email}
print "-------------------------------"
print ${person.lotto[*]}
print "-------------------------------"
print -j person
print "-------------------------------"
unset person
compound person
compound person=(firstname="John" lastname="Some" age=32)
print -j person
print "-------------------------------"
printf "%(json)B\n" person
print "-------------------------------"
But if you read twice same lines, second reading give error ...
I have tested built ksh
- Win10 WSL Ubuntu 18.04
- Debian 9
Same problem.
from ast.
I realize the JSON functionality in Korn Shell isn't fully mature yet, ....
Not only is native JSON support by ksh not mature it also has significant bugs. See issue #820. My recommendation is to remove the JSON related code. At the moment, by necessity, the focus is on a ksh release that could replace ksh93u+ from 2012 but that is much easier to maintain.
from ast.
Since current implementation for json support is broken, we are going to disable it in next release. We may reintroduce it in future, but it won't be done without solid testing. Closing this issue as it does not serve any purpose now.
from ast.
Related Issues (20)
- Function scoped variable should retain its last value in while-loop body HOT 3
- printf %q broken with size specifier HOT 7
- 2020.0.0: test suite is failing HOT 8
- ksh: command substitution doesn't include the output of non-waited-for child processes HOT 1
- write package as an rpm (/bin/pacakge make) HOT 6
- Please fix invalid use of memccpy() on master HOT 5
- MacOS compiling libast
- ${$} throwing syntax error when use in cat << EOF on ksh93 93u+ . HOT 1
- Use of >/dev/null 2>&1 in called function causes "Abort(coredump)" HOT 4
- The subshell does not recognize the path path.
- Process substitution includes extraneous spaces in file descriptor HOT 1
- `a=()` should make `a` an empty array but doesn't HOT 2
- $EDITOR
- man page uses incorrect pipe character, "⎪" xE28EAA instead of "|" x7C HOT 1
- Please consider relicensing AST under the EPL-2.0 with the GPL compatibility clause
- ksh93u+ dumps core when fds >32 HOT 1
- building with Cygwin instead of NMAKE HOT 2
- The release page for the latest version of ksh boggles HOT 1
- undefined reference to `__dso_handle' HOT 3
- support HISTCONTROL=ignoredups HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ast.