Skip to content

Unterminated string: missing closing quote even though every quote is terminated. #40

@33sakib33

Description

@33sakib33

Description

When I try to translate TOON into JSON , it shows Unterminated string: missing closing quote even though every quote is terminated.

This is the input payload

translations[8|]{id|translation}:
  1|"Stop your grinning," I shouted, "and why didn't you tell me that dreadful harpooner was a cannibal?"
  2|"I thought you knew it;—didn't I tell you he was selling heads around town?—but roll over again and go to sleep. Queequeg, look here—you understand me, I understand—you sleep with this man—you understand?"
  3|"I understand completely"—grunted Queequeg, puffing away at his pipe and sitting up in bed.
  4|"You get in," he added, gesturing to me with his tomahawk, and tossing the covers to one side. He really did this in not only a polite but a truly kind and generous way. I stood looking at him for a moment. Despite all his tattoos, he was, on the whole, a clean, pleasant-looking cannibal. What's all this fuss I've been making, I thought to myself—this man is a human being just like me: he has just as much reason to fear me as I have to be afraid of him. It's better to sleep with a sober cannibal than a drunken Christian.
  5|"Landlord," I said, "tell him to put his tomahawk away, or his pipe, or whatever you call it; tell him to stop smoking, in short, and I will get into bed with him. But I don't like having a man smoking in bed with me. It's dangerous. Besides, I'm not insured."
  6|When this was told to Queequeg, he immediately complied, and again politely gestured for me to get into bed—rolling over to one side as if to say—"I won't touch any part of you."
  7|"Good night, landlord," I said, "you can go."
  8|I got into bed, and never slept better in my life.

Reproduction Steps

  1. Store this toon string in a variable
    var="""translations[8|]{id|translation}: 1|"Stop your grinning," I shouted, "and why didn't you tell me that dreadful harpooner was a cannibal?" 2|"I thought you knew it;—didn't I tell you he was selling heads around town?—but roll over again and go to sleep. Queequeg, look here—you understand me, I understand—you sleep with this man—you understand?" 3|"I understand completely"—grunted Queequeg, puffing away at his pipe and sitting up in bed. 4|"You get in," he added, gesturing to me with his tomahawk, and tossing the covers to one side. He really did this in not only a polite but a truly kind and generous way. I stood looking at him for a moment. Despite all his tattoos, he was, on the whole, a clean, pleasant-looking cannibal. What's all this fuss I've been making, I thought to myself—this man is a human being just like me: he has just as much reason to fear me as I have to be afraid of him. It's better to sleep with a sober cannibal than a drunken Christian. 5|"Landlord," I said, "tell him to put his tomahawk away, or his pipe, or whatever you call it; tell him to stop smoking, in short, and I will get into bed with him. But I don't like having a man smoking in bed with me. It's dangerous. Besides, I'm not insured." 6|When this was told to Queequeg, he immediately complied, and again politely gestured for me to get into bed—rolling over to one side as if to say—"I won't touch any part of you." 7|"Good night, landlord," I said, "you can go." 8|I got into bed, and never slept better in my life."""

  2. Now we decode
    decode(var)

Expected Behavior

{ "translations": [ { "id": 1, "translation": "\"Stop your grinning,\" I shouted, \"and why didn't you tell me that dreadful harpooner was a cannibal?\"" }, { "id": 2, "translation": "\"I thought you knew it;—didn't I tell you he was selling heads around town?—but roll over again and go to sleep. Queequeg, look here—you understand me, I understand—you sleep with this man—you understand?\"" }, { "id": 3, "translation": "\"I understand completely\"—grunted Queequeg, puffing away at his pipe and sitting up in bed." }, { "id": 4, "translation": "\"You get in,\" he added, gesturing to me with his tomahawk, and tossing the covers to one side. He really did this in not only a polite but a truly kind and generous way. I stood looking at him for a moment. Despite all his tattoos, he was, on the whole, a clean, pleasant-looking cannibal. What's all this fuss I've been making, I thought to myself—this man is a human being just like me: he has just as much reason to fear me as I have to be afraid of him. It's better to sleep with a sober cannibal than a drunken Christian." }, { "id": 5, "translation": "\"Landlord,\" I said, \"tell him to put his tomahawk away, or his pipe, or whatever you call it; tell him to stop smoking, in short, and I will get into bed with him. But I don't like having a man smoking in bed with me. It's dangerous. Besides, I'm not insured.\"" }, { "id": 6, "translation": "When this was told to Queequeg, he immediately complied, and again politely gestured for me to get into bed—rolling over to one side as if to say—\"I won't touch any part of you.\"" }, { "id": 7, "translation": "\"Good night, landlord,\" I said, \"you can go.\"" }, { "id": 8, "translation": "I got into bed, and never slept better in my life." } ] }

Actual Behavior

Unterminated string: missing closing quote even though every quote is terminated.

Environment

  • Environment: Google Colab
  • Python version: Python 3.12.12
  • toon_format version
    • Name: toon_format
    • Version: 0.9.0b1
    • Summary: A compact, human-readable serialization format designed for passing structured data to Large Language Models with significantly reduced token usage
    • Home-page: https://github.com/toon-format/toon-python
    • Author:
    • Author-email: Johann Schopplich <[email protected]>
    • License: MIT
    • Location: /usr/local/lib/python3.12/dist-packages
    • Requires:
    • Required-by:

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions