Parse & Organize Multiple Variables At Once



  • Hello! I am working on a config, and the capture is a BUNCH of data in a format similar to this.....

    {"id":"xxXxxx","tags":"xxxxxx","length":75286,"time":"xxxxxxx","text":"xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx"}
    {"id":"xxXxxx","tags":"xxxxxx","length":75286,"time":"xxxxxxx","text":"xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx"}
    {"id":"xxXxxx","tags":"xxxxxx","length":75286,"time":"xxxxxxx","text":"xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx"}
    {"id":"xxXxxx","tags":"xxxxxx","length":75286,"time":"xxxxxxx","text":"xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx"}
    {"id":"xxXxxx","tags":"xxxxxx","length":75286,"time":"xxxxxxx","text":"xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx"}
    

    I already have the config saving the capture to a txt file. Is there a way to sort it out better, and have certain text replaced?

    For example, make OB replace every "text":" with Title:

    OR

    every {"id":" with ID



  • @TrillyReign You could try Function Block

    FUNCTION Replace "id" "ID" "<MyCapture>" -> VAR "CapturePrettyID" 
    FUNCTION Replace "text" "Title" "<MyCapture>" -> VAR "CapturePrettyT"
    

  • Admin

    If it's a list, functions can take lists and output lists.
    For example the answer above becomes

    FUNCTION Replace "{\"id\"" "ID" "<MyList[*]>" -> CAP "MyList" 
    


  • @Br4uN said in Parse & Organize Multiple Variables At Once:

    @TrillyReign You could try Function Block

    FUNCTION Replace "id" "ID" "<MyCapture>" -> VAR "CapturePrettyID" 
    FUNCTION Replace "text" "Title" "<MyCapture>" -> VAR "CapturePrettyT"
    

    @Ruri said in Parse & Organize Multiple Variables At Once:

    If it's a list, functions can take lists and output lists.
    For example the answer above becomes

    FUNCTION Replace "{\"id\"" "ID" "<MyList[*]>" -> CAP "MyList" 
    

    Thank you for helping!!! I knew it was a function block. Just couldn't get it to work. Again, thank you!!!


Log in to reply