wikitable2json icon indicating copy to clipboard operation
wikitable2json copied to clipboard

Add optional the all informations from the table including e.g. the actual link

Open zukunft opened this issue 10 months ago • 2 comments

It would be nice, if there is an option to include all information from the table in the json e.g. for ISO_3166-1 it returns "Bolivia, Plurinational State of" but the link which is only "Bolivia".

If I call https://www.wikitable2json.com/api/ISO_3166-1 I get:

... ,["Bolivia, Plurinational State of","BO","BOL","068","ISO 3166-2:BO","Yes"], ...

Would be nice if there would be an option to receive e.g. :

... ,[["Bolivia, Plurinational State of","Bolivia"],"BO","BOL","068","ISO 3166-2:BO","Yes"], ...

or

... ,["Bolivia, Plurinational State of",{"link": "Bolivia"}],,"BO","BOL","068","ISO 3166-2:BO","Yes"], ...

zukunft avatar Apr 06 '24 13:04 zukunft

I'm away from my computer but I'll look into this next week.

atye avatar Apr 06 '24 20:04 atye

Your proposals may work but it's not clear which entity is which; the text or the link. If more things are added in the future, it'll get more confusing.

What do you think about an option to enable a response like this? Each value contains keys to specify the entity and it's easy to add fields in the future.

[
  {
    "text": "Bolivia, Plurinational State of",
    "link": "Boliva"
  },
  {
    "text": "BO",
    "link": ""
  }
]

atye avatar Apr 09 '24 01:04 atye

It's been three weeks. You can re-open this if you still want to discuss.

atye avatar Apr 30 '24 20:04 atye

Sorry, this time I have been away from my PC. Your suggestion looks fine for me.

zukunft avatar Jun 29 '24 06:06 zukunft

I decided to make the links an array because a cell could have multiple links in the text. These changes are live. Let me know if this works for you.

https://www.wikitable2json.com/api/ISO_3166-1?verbose=true https://www.wikitable2json.com/api/ISO_3166-1?verbose=true&keyRows=1

Here is the matrix format:

 [
      {
        "text": "Bolivia, Plurinational State of",
        "links": [
          "Bolivia"
        ]
      },
      {
        "text": "BO",
        "links": [
          "ISO_3166-1_alpha-2#BO"
        ]
      },
      {
        "text": "BOL",
        "links": null
      },
      {
        "text": "068",
        "links": null
      },
      {
        "text": "ISO 3166-2:BO",
        "links": [
          "ISO_3166-2:BO"
        ]
      },
      {
        "text": "Yes",
        "links": null
      }
    ]

keyValue format:

    {
      "Alpha-2 code": {
        "text": "BO",
        "links": [
          "ISO_3166-1_alpha-2#BO"
        ]
      },
      "Alpha-3 code": {
        "text": "BOL",
        "links": null
      },
      "English short name  (using title case)": {
        "text": "Bolivia, Plurinational State of",
        "links": [
          "Bolivia"
        ]
      },
      "Independent": {
        "text": "Yes",
        "links": null
      },
      "Link to  ISO 3166-2": {
        "text": "ISO 3166-2:BO",
        "links": [
          "ISO_3166-2:BO"
        ]
      },
      "Numeric code": {
        "text": "068",
        "links": null
      }
    }

atye avatar Jul 01 '24 16:07 atye