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.

Multiline for multiple values within square brackets

See original GitHub issue

Thanks for this tool! Would there be a way to make jtbl recognize that values separated by commas within square brackets should be on new lines, with json files of the following structure?

{
  "Date": [
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00",
    "2021-08-24 21:00:00"
  ],
  "Location": [
    "Indonesia - TERNATE/BABULLAH",
    "Bolivia - TRINIDAD",
    "United States - PENSACOLA, FL",
    "Russian Federation - IVDEL'",
    "India - GULBARGA",
    "Honduras - CHOLUTECA",
    "United States - JACKSONVILLE/INTNL.,  FL.",
    "Honduras - LA MESA (SAN PEDRO SULA)",
    "Russian Federation - JARCEVO",
    "Russian Federation - VEL' MO",
    "Azerbaijan - GUBA",
    "Niger - NIAMEY-AERO",
    "Vietnam - PHU LIEN"
  ]
}

Currently, when I pipe that into jtbl, it just shows a table with two columns and a single row containing all values separated by commas.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
kellyjonbrazilcommented, Sep 1, 2021

I opened a feature request to investigate how to do this. (#7)

1reaction
Kabouikcommented, Aug 27, 2021

Awesome! Now the json file indeed is much easier to read, and I can simplify the bash script:

print() {
    if [ -z "$1" ]; then
        cod="$(fzf < "$WE_DIR"/setup/codes.txt)"
        jello < "$WE_DIR"/data/"$cod".json
    else
        cod=$(echo "$1" | tr '[:lower:]' '[:upper:]')
        jello < "$WE_DIR"/data/"$cod".json
    fi
}

table() {
    print "$1" | jtbl -n | less -S
}

This is getting exciting! I need to focus on better implementing fzf (handle multi selections, offer only available data and not the full list, possibly prompt for scraping if not already done) and adding human-readable categories, but on the Python side I think my main issue will be when repeating requests multiple times: this appends the new result to the existing json file, but won’t check for duplicates. I’ll check your repositories, I see that there are a lot of json manipulation tools and maybe there’s already something to deal with this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regex python: match multi-line float values between brackets
In the below example data, I want to extract all the float values between brackets belonging only to "group1" using regex, but not...
Read more >
Multiple lines one side of equation with a Curly Bracket - TeX
Closed 6 years ago. I am trying to write an equation that looks like this, everything should be left aligned on the right...
Read more >
Multi-line arrays in square brackets cause YAMLSemanticError
The library fails to parse multi-line arrays in square brackets. I stumbled upon this issue when speccy used this library for parsing the ......
Read more >
How to bracket over multiple lines of text in Word document?
Bracket over multiple lines of text with formula box · 1. Press the “Alt” + “=” keys to insert a formula box, and...
Read more >
Brackets and Parentheses - Overleaf, Online LaTeX Editor
You can easily control the size and style of brackets in LaTeX; this article explains how. Here's an table of listing some common...
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