AutoIt语言的json支持

    技术2022-05-20  25

    http://www.autoitscript.com/forum/topic/104150-json-udf-library-fully-rfc4627-compliant/

    请前往该网址自行下载。

     

    不过该库有个小问题,就是不支持数组或对象结束符前多留个逗号,即支持[1,2,3]当时不支持[1,2,3,],这很要命的,因为很多json文件是程序生成的,生成时就多带了个逗号,C语言都支持这个多余的逗号,json当然也应该支持,json-c是支持的。

    所以必须为这个UDF添加上这个功能,patch内容:

    @@ -503,6 +503,10 @@              case ','                  __JSONReadNext()                  __JSONSkipWhitespace() +                If $__JSONCurr == '}' Then +                    __JSONReadNext() +                    return $o +                EndIf              case else                  if not $__JSONWhitespaceWasFound then                      ; badly-formatted object @@ -567,6 +571,10 @@              case ','                  __JSONReadNext()                  __JSONSkipWhitespace() +                If $__JSONCurr == ']' Then +                    __JSONReadNext() +                    return $a +                EndIf              case else                  if not $__JSONWhitespaceWasFound then                      ; badly-formatted array


    最新回复(0)