• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

JSON Selecttransform Integration Problem

Status
Not open for further replies.

marlon1337

Member
Hi guys,
I can't figure out how to transform a json with the selecttransform integration.
The template works at https://selecttransform.github.io/playground/ but when pasting it to Pabbly I get an error.
Here is what works on the selecttransform playground:
JSON:
var data =
[{"id":1000470,"name":"Rainglide One 70cm","product_id":230412,"variation_id":0,"quantity":2,"tax_class":"","subtotal":"42.61","subtotal_tax":"9.37","total":"42.61","total_tax":"9.37","taxes":[{"id":63,"total":"9.373443","subtotal":"9.373443"}],"meta_data":[{"id":1004807,"key":"_unit","value":"","display_key":"_unit","display_value":""},{"id":1004808,"key":"_unit_base","value":"","display_key":"_unit_base","display_value":""},{"id":1004809,"key":"_unit_product","value":"","display_key":"_unit_product","display_value":""},{"id":1004810,"key":"_item_desc","value":"","display_key":"_item_desc","display_value":""},{"id":1004811,"key":"_defect_description","value":"","display_key":"_defect_description","display_value":""},{"id":1004812,"key":"_delivery_time","value":"","display_key":"_delivery_time","display_value":""},{"id":1004813,"key":"_min_age","value":"","display_key":"_min_age","display_value":""}],"sku":"RO70","price":21.3032785,"image":{"id":"230396","src":"https:\/\/rainglide.com\/wp-content\/uploads\/2025\/01\/Rainglie-One-Shop-Picture.jpg"},"parent_name":null},{"id":1000471,"name":"Rainglide One 65cm","product_id":230411,"variation_id":0,"quantity":3,"tax_class":"","subtotal":"63.91","subtotal_tax":"14.06","total":"63.91","total_tax":"14.06","taxes":[{"id":63,"total":"14.060164","subtotal":"14.060164"}],"meta_data":[{"id":1004823,"key":"_unit","value":"","display_key":"_unit","display_value":""},{"id":1004824,"key":"_unit_base","value":"","display_key":"_unit_base","display_value":""},{"id":1004825,"key":"_unit_product","value":"","display_key":"_unit_product","display_value":""},{"id":1004826,"key":"_item_desc","value":"","display_key":"_item_desc","display_value":""},{"id":1004827,"key":"_defect_description","value":"","display_key":"_defect_description","display_value":""},{"id":1004828,"key":"_delivery_time","value":"","display_key":"_delivery_time","display_value":""},{"id":1004829,"key":"_min_age","value":"","display_key":"_min_age","display_value":""}],"sku":"RO65","price":21.303278666666667,"image":{"id":"230396","src":"https:\/\/rainglide.com\/wp-content\/uploads\/2025\/01\/Rainglie-One-Shop-Picture.jpg"},"parent_name":null},{"id":1000472,"name":"Rainglide One 60cm","product_id":230410,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"20.48","subtotal_tax":"4.51","total":"20.48","total_tax":"4.51","taxes":[{"id":63,"total":"4.506394","subtotal":"4.506394"}],"meta_data":[{"id":1004839,"key":"_unit","value":"","display_key":"_unit","display_value":""},{"id":1004840,"key":"_unit_base","value":"","display_key":"_unit_base","display_value":""},{"id":1004841,"key":"_unit_product","value":"","display_key":"_unit_product","display_value":""},{"id":1004842,"key":"_item_desc","value":"","display_key":"_item_desc","display_value":""},{"id":1004843,"key":"_defect_description","value":"","display_key":"_defect_description","display_value":""},{"id":1004844,"key":"_delivery_time","value":"","display_key":"_delivery_time","display_value":""},{"id":1004845,"key":"_min_age","value":"","display_key":"_min_age","display_value":""}],"sku":"RO60","price":20.483607,"image":{"id":"230396","src":"https:\/\/rainglide.com\/wp-content\/uploads\/2025\/01\/Rainglie-One-Shop-Picture.jpg"},"parent_name":null}]

;
var template = {
  billable:{
  products: {
    "{{#each this}}": {
      name: "{{this.name}}",
      qty: "{{this.quantity}}",
      unit_price: "{{this.price}}"
    }}
  }
}

Here is the error in pabbly. I tried pasting it in many ways. with "" for every value, deleting breaks and spaces adding three {{{, with template= with var = template... etc. All possible combinations, nothing works.
pabbly error.png


In the end I need the transformed JSON to be the raw data in a custom API POST. The transformed JSON for the JSON above will look like this:
Code:
{
  "billable": {
    "products": [
      {
        "name": "Rainglide One 70cm",
        "qty": 2,
        "unit_price": 21.3032785
      },
      {
        "name": "Rainglide One 65cm",
        "qty": 3,
        "unit_price": 21.303278666666667
      },
      {
        "name": "Rainglide One 60cm",
        "qty": 1,
        "unit_price": 20.483607
      }
    ]
  }
}

Inserted here:
Pabbly preferable outcome.png


I appreciate any help. Thank you!
 

Preeti Paryani

Moderator
Staff member
Pro Member
Hello @marlon1337,


We have added a Select transform JSON action step as step 4 of your workflow which seems to be working fine please refer to the attached image for more info.

1744005205233.png
 

marlon1337

Member
@Preeti Paryani
Thanks, but it still is not the same as the result from selecttransform as it should be.
The correct result is:
Code:
{
  "billable": {
    "products": [
      {
        "name": "Rainglide One 70cm",
        "qty": 2,
        "unit_price": 21.3032785
      },
      {
        "name": "Rainglide One 65cm",
        "qty": 3,
        "unit_price": 21.303278666666667
      },
      {
        "name": "Rainglide One 60cm",
        "qty": 1,
        "unit_price": 20.483607
      }
    ]
  }
}

right now the result after your change is just:
Code:
[{"name":"Rainglide One 70cm","qty":2,"unit_price":21.3032785},{"name":"Rainglide One 65cm","qty":3,"unit_price":21.303278666666667},{"name":"Rainglide One 60cm","qty":1,"unit_price":20.483607}]

I actually expect the same outcome as on the playground page. As this is what I am aiming on, as this is the form which is required.

//Edit: And it is just working for the step you changed. When I try to replicate this step (without copying it) I again see the same error with 'invalid request format'. Because I have to replicate this step in another workflow. This workflow is just to test around.
 

Preeti Paryani

Moderator
Staff member
Pro Member
Hello @marlon1337,

Please check now the result should be as the expected one. Also, if you want to use the same action step in another workflow you can simply copy the action and paste it below the required step.
 

marlon1337

Member
@Preeti Paryani
Thank you, almost there. I would need the exact outcome as in the playground. Right now I still have the [ ] at the beginning and the end which would then require another text regex transformation step from me. Would you be able to adjust the outcome to exactly to what is shown on the selecttransform playground? It's just the [ and ] at the beginning and end which should not be there.Thank you!
 

ArshilAhmad

Moderator
Staff member
We have added Python code to your workflow to remove the outermost square brackets. Please check Step 5 of your workflow.
1744135053549.png
 

marlon1337

Member
@ArshilAhmad I would like to use a free workflow step like text transform with regex to remove the outside brackets. However Regex like /^\[(.*)\]$ which works when testing on Regex test tools is not returning anything in pabbly. I tried multiple regexes which should return the same capture groups. Best would that I just get exact the same output as selecttransform gives, then the problem would be solved. An extra non free workflow step is not an option as I want to run this task a lot and Regex or selecttransform should work correctly.
 

marlon1337

Member
@Preeti Paryani this is not okay. The problem only occurs because selecttransform is not working correctly as it should. And Regex is also not working correctly. This is obviously a bug/not good made integration.
 

Preeti Paryani

Moderator
Staff member
Pro Member
Hello @marlon1337,

We’ve helped configure the Select Transform, and it’s returning the expected result—so it does seem to be functioning as intended. However, please note that this particular step is not part of the free steps.

Regarding the Regex, the current implementation supports basic use cases. The specific requirement you're aiming for goes a bit beyond what’s currently supported, so we may not be able to fully accommodate that at the moment.

That said, we recommend continuing with the Select Transform action, as it is successfully returning the desired response.
 

marlon1337

Member
@Preeti Paryani no, the actual result of selecttransform is without [ ] .
This is the correct result and there should not be any bracket or anything else appearing. It's the whole point of using selecttransform to get exactly the return to fit the template.
Correct result for the template as also shown at the playground:
Code:
{
  "billable": {
    "products": [
      {
        "name": "Rainglide One 70cm",
        "qty": 2,
        "unit_price": 21.3032785
      },
      {
        "name": "Rainglide One 65cm",
        "qty": 3,
        "unit_price": 21.303278666666667
      },
      {
        "name": "Rainglide One 60cm",
        "qty": 1,
        "unit_price": 20.483607
      }
    ]
  }
}
 

Preeti Paryani

Moderator
Staff member
Pro Member
Hello @marlon1337,

We have added two Text Formatter actions to your workflow to get the desired result, refer to the attached image for more info.

1744193253298.png


The step 4 is now returning the correct response.

1744193263736.png
 
Status
Not open for further replies.
Top