question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

is there a reason that the contents of heredoc blocks are loaded as a single string instead of as json? If a single line is added at the bottom of the _end_heredoc() method like this:

t.value = json.loads(t.value)

the contents of the heredoc will be accessible as a dictionary like the rest of the document.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
scottbeldencommented, Apr 1, 2019

Yes, that could be done, but it would be a breaking change for anyone that has a heredoc that is JSON-like but they expect it to be loaded as a string. Everything I have found regarding heredocs seems to indicate that the contents should be treated as a string and not implicitly converted to something else.

1reaction
scottbeldencommented, Apr 1, 2019

I see. Unfortunately I don’t believe there is any requirement that heredocs must be in some JSON structure. For example, the official HCL repo has a test where the heredoc is not in a JSON structure: https://github.com/hashicorp/hcl/blob/master/test-fixtures/multiline.hcl

Therefore, this is something that would have to be done in post processing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bash HereDoc Tutorial With Examples | phoenixNAP KB
Learn how to use here documents (HereDocs) to parse multiline commands and enhance your terminal and Bash scripting knowledge.
Read more >
Here Documents - The Linux Documentation Project
A here document is a special-purpose code block. It uses a form of I/O redirection to feed a command list to an interactive...
Read more >
How to Use Heredoc in Shell Scripting - Tecmint
Here document (Heredoc) is an input or file stream literal that is treated as a special block ... which is passed to a...
Read more >
How to use Here Document in bash programming - Linux Hint
A block of code or text which can be redirected to the command script or interactive program is called here document or HereDoc....
Read more >
Bash Heredoc Tutorial For Beginners - OSTechNix
HereDoc, acronym for Here Document, is an input Redirection method to pass multiple inputs to a program or command in Bash.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found