JQ can't parse u2022 character











up vote
0
down vote

favorite












I'm trying to perform a bulk upload to Elasticsearch (around 1mln documents). In order to do that, I'm using jq to reformat the JSON file extracted from MySQL database and curl to post the data to Elasticsearch:



cat dataset.json | jq -r -c '. | { "index" : { } }, .' | curl -u login:password -H "Content-Type: application/json" -XPOST "https://.../skills/default/_bulk?pretty" --data-binary @-


I get an error:




parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 276249, column 317




I found that the character that jq can't parse is u2022. I tried adding "-r" jq command but the error stil occurs. How can I handle this for all occurrences of u2022?










share|improve this question
























  • Please follow the Minimal, Complete, and Verifiable example guidelines.
    – peak
    Nov 18 at 8:30















up vote
0
down vote

favorite












I'm trying to perform a bulk upload to Elasticsearch (around 1mln documents). In order to do that, I'm using jq to reformat the JSON file extracted from MySQL database and curl to post the data to Elasticsearch:



cat dataset.json | jq -r -c '. | { "index" : { } }, .' | curl -u login:password -H "Content-Type: application/json" -XPOST "https://.../skills/default/_bulk?pretty" --data-binary @-


I get an error:




parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 276249, column 317




I found that the character that jq can't parse is u2022. I tried adding "-r" jq command but the error stil occurs. How can I handle this for all occurrences of u2022?










share|improve this question
























  • Please follow the Minimal, Complete, and Verifiable example guidelines.
    – peak
    Nov 18 at 8:30













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to perform a bulk upload to Elasticsearch (around 1mln documents). In order to do that, I'm using jq to reformat the JSON file extracted from MySQL database and curl to post the data to Elasticsearch:



cat dataset.json | jq -r -c '. | { "index" : { } }, .' | curl -u login:password -H "Content-Type: application/json" -XPOST "https://.../skills/default/_bulk?pretty" --data-binary @-


I get an error:




parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 276249, column 317




I found that the character that jq can't parse is u2022. I tried adding "-r" jq command but the error stil occurs. How can I handle this for all occurrences of u2022?










share|improve this question















I'm trying to perform a bulk upload to Elasticsearch (around 1mln documents). In order to do that, I'm using jq to reformat the JSON file extracted from MySQL database and curl to post the data to Elasticsearch:



cat dataset.json | jq -r -c '. | { "index" : { } }, .' | curl -u login:password -H "Content-Type: application/json" -XPOST "https://.../skills/default/_bulk?pretty" --data-binary @-


I get an error:




parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 276249, column 317




I found that the character that jq can't parse is u2022. I tried adding "-r" jq command but the error stil occurs. How can I handle this for all occurrences of u2022?







json unicode jq






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 at 2:55









peak

28.6k73752




28.6k73752










asked Nov 17 at 15:17









Alit

165




165












  • Please follow the Minimal, Complete, and Verifiable example guidelines.
    – peak
    Nov 18 at 8:30


















  • Please follow the Minimal, Complete, and Verifiable example guidelines.
    – peak
    Nov 18 at 8:30
















Please follow the Minimal, Complete, and Verifiable example guidelines.
– peak
Nov 18 at 8:30




Please follow the Minimal, Complete, and Verifiable example guidelines.
– peak
Nov 18 at 8:30












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Here's verification that u2022 is properly handled by various versions of jq in a Mac environment:



$ echo '"u2022"' | jq-1.4 .
"•"
$ echo '"•"' | jq-1.6 .
"•"
$ echo '"•"' | jq-1.5 .
"•"
$ echo '"•"' | jq-1.4 .
"•"
$


Perhaps the problem is related to a bug that was fixed since the release of jq 1.5 (see e.g. https://github.com/stedolan/jq/issues/1311).



If you are having difficulties with jq version 1.6 (the current version), please provide a minimal complete verifiable example
with further details about the computing environment.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352558%2fjq-cant-parse-u2022-character%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Here's verification that u2022 is properly handled by various versions of jq in a Mac environment:



    $ echo '"u2022"' | jq-1.4 .
    "•"
    $ echo '"•"' | jq-1.6 .
    "•"
    $ echo '"•"' | jq-1.5 .
    "•"
    $ echo '"•"' | jq-1.4 .
    "•"
    $


    Perhaps the problem is related to a bug that was fixed since the release of jq 1.5 (see e.g. https://github.com/stedolan/jq/issues/1311).



    If you are having difficulties with jq version 1.6 (the current version), please provide a minimal complete verifiable example
    with further details about the computing environment.






    share|improve this answer



























      up vote
      0
      down vote













      Here's verification that u2022 is properly handled by various versions of jq in a Mac environment:



      $ echo '"u2022"' | jq-1.4 .
      "•"
      $ echo '"•"' | jq-1.6 .
      "•"
      $ echo '"•"' | jq-1.5 .
      "•"
      $ echo '"•"' | jq-1.4 .
      "•"
      $


      Perhaps the problem is related to a bug that was fixed since the release of jq 1.5 (see e.g. https://github.com/stedolan/jq/issues/1311).



      If you are having difficulties with jq version 1.6 (the current version), please provide a minimal complete verifiable example
      with further details about the computing environment.






      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        Here's verification that u2022 is properly handled by various versions of jq in a Mac environment:



        $ echo '"u2022"' | jq-1.4 .
        "•"
        $ echo '"•"' | jq-1.6 .
        "•"
        $ echo '"•"' | jq-1.5 .
        "•"
        $ echo '"•"' | jq-1.4 .
        "•"
        $


        Perhaps the problem is related to a bug that was fixed since the release of jq 1.5 (see e.g. https://github.com/stedolan/jq/issues/1311).



        If you are having difficulties with jq version 1.6 (the current version), please provide a minimal complete verifiable example
        with further details about the computing environment.






        share|improve this answer














        Here's verification that u2022 is properly handled by various versions of jq in a Mac environment:



        $ echo '"u2022"' | jq-1.4 .
        "•"
        $ echo '"•"' | jq-1.6 .
        "•"
        $ echo '"•"' | jq-1.5 .
        "•"
        $ echo '"•"' | jq-1.4 .
        "•"
        $


        Perhaps the problem is related to a bug that was fixed since the release of jq 1.5 (see e.g. https://github.com/stedolan/jq/issues/1311).



        If you are having difficulties with jq version 1.6 (the current version), please provide a minimal complete verifiable example
        with further details about the computing environment.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 18 at 8:28

























        answered Nov 17 at 22:34









        peak

        28.6k73752




        28.6k73752






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352558%2fjq-cant-parse-u2022-character%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Paul Cézanne

            UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

            Angular material date-picker (MatDatepicker) auto completes the date on focus out