What is the best way to do this? (Parsing links, then use it as GET request)

  1. I need to parse the response via JSON.
  2. Parsed data comes out as /link.
  3. The GET request must not include the /.

How can I remove the / before the link? Translate? Replace?

I’ve tried Translate but I’m doing this on a FOREACH since I need the links to be recursive.

The only solution I’ve found is Regex Replace but I’m guessing there’s a much more efficient method?

EDIT: My problem now is, if I put the Regex Replace block outside the FOREACH block, I get an error:

The name 'dirs2x' does not exist in the current context

If I put it inside, it loops on the replace until it crashes. Should I do Add To List instead?

You can use some C# to do this very fast

link = link[1..];

where link is the name of your variable.
I have a guide on changing the original list in a foreach loop, please see the second post on this topic

1 Like

I’ll try this out and yes, I based my code on that very helpful thread of yours. I’ve read on Sololearn and Coursera , but reading your code was the easiest way for me to understand FOREACH function.

If you need more help, post a sample list and I will give you the full LoliCode to remove the leading / from all its elements

1 Like

Hey Ruri. The API I’m working with has changed and I’m stuck.

    "folder": {
        "data": [{
            "is_folder": "true",
            "x_path": "/Public",
            "x_name": "Repo",
        }, {
            "is_folder": "false",
            "size": 56895,
            "x_path": "/Public",
            "x_name": ".htaccess",

I used your guide on the iterating lists. Here’s what I want to accomplish:

  • Get the folder names and adding the prefix of the “x_path” to it. “/Public/Repo” so that I can use that to go to the next folder.
  • I also need to add the new files to the constant list of files that i have created. My problem is, I can’t use JSON for parsing since that would include the folder names. I tried doing it with Regex with the following, but I’m getting an error.
Pattern: (false\".*name\\:\")(.*)(\")
Output: [2]

I know you have the answer to this, boss. Please guide me. I need your help.

Sorry I don’t have time at the moment contact me in a few days

Since that is json, it might be easier to just use json then xpath

$.folder.data[1].x_name = .htaccess
$. = start the query
folder = next available key
data[1] = next available key w/ 0,1 for which block to get
x_name = .htaccess

If you have a random amount of blocks you can always throw it in a loop and use a if then statement


loop 0 - xxx
if folder.data.is_folder false then
copy x_name

1 Like

I’ll try this one later. Thanks for reaching out man!

Anytime and good luck