[BUG?] Wierd String Behaviour

I have a string, in a certain format that does not successfully get written to JSON / get’s lost as it passed through the flow. variable {{“ibikeRef”: “20220812H01958”}}


Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:

Hi @Luke_Austin, I am sorry to hear you’re having trouble. Unfortunately I am not able to run your example workflow as your HTTP Requests seems to require authentication data I don’t have. Could you share the JSON data returned by your HTTP Request node so I can test this on my side?

Hey @mutedjam!

Yep - i tried to copy & paste with pinned data, which doesn’t work (but would be cool)!

Here’s the JSON output of the HTTP node:



"data": "<!DOCTYPE html> <html lang="en-GB" dir="ltr"> <head> <meta charset="utf-8"> <title>BIKETRAX HIRE AGREEMENT 20220812H01958 Haytham A. Al-barrak</title> <link href="https://fonts.googleapis.com/css?family=Cabin" rel="stylesheet"> <style type="text/css"> body { background-color: #FFFFFF; background-image: none; font-family: 'Cabin', sans-serif; color: #000000; font-size: 1em; padding: 0; margin: 0; } @media print { @page { margin-bottom: 0;} body { font-size: 0.7em;} .pagebreak { page-break-before: always; } } table {width:100%; margin: 1em 0;} table th {width: 50%} table th.price {width: 25%} table td.price {text-align:right;} .sig {display: inline-block; width: 50%; padding-top: 50px; border:1px solid #000;} .sigdate {display: inline-block; width: 20%; padding-top: 50px; margin-left: 2%;border:1px solid #000;} a.asButton {display:block; width: 50%; margin: 1em auto; padding: 5px 0; background-color: #333; border: 2px outset #333;border-radius: 5px; color:#FFF;text-decoration:none;text-align:center;} a.asButton:hover {background-color: #999;border: 2px inset #999;} div.costofhire {background-color:#DDD; text-align:right;font-size: 2em; font-weight:bold;} div.signature {font-size: 3em;} </style> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <img src="https://biketrax.co.uk/smsimg/uploads/hirestuff/report-header-new.jpg" alt="" style="width:100%; height: auto; margin-bottom:20px;"> <p>Bicycle hire agreement between BIKETRAX and:<br> Haytham A. Al-barrak<br>xxxxxxxt<br>Edinburgh<br>Scotlant<br>EH37RF<br><br> Phone: +xxxxx</p> <p><h1>Booking Reference: 20220812H01958</h1> Booking made: 12th August 2022 <h2>1 days hire from: 13th August 2022 until 14th August 2022</h2></p> <p>PLEASE READ THE FULL AGREEMENT AND CLICK SIGN AGREEMENT TO INDICATE YOUR ACCEPTANCE.<br> Hire bookings are not considered final until the agreement has been signed.</p> <table><tbody><tr><th scope="col">Item</th><th scope="col" class="price">Security Deposit</th><th scope="col" class="price">Hire Cost</th></tr> <tr><td>Hire of Cinelli Superstar Disc L</td><td class="price deposit">&#163;1619.00</td><td class="price">&#163;60.00</td></tr> </tbody></table> <p class="costofhire">Total Hire Cost: &#163;60.00</p> <p> <h2>SECURITY DEPOSIT</h2> As part of your hire agreement, you need to provide security in the form of a deposit to cover loss and/or damage of the goods being hired.<br> We offer the option to pay a non-refundable damage waiver fee in place of leaving a security deposit which would waiver our claim for minor mechanical damages<br> You needn't make your final decision until your collect, but you can do so at any point prior to collection.</p> <p>Current Choice: Leave A Security Deposit</p> <p><h3>SECURITY DEPOSIT: &#163;1619.00</h3> Before your bikes are collected, we will pre-authorise a deposit on your credit/debit card covering a proportion of the value of the hired items, as security until the items are returned in good condition. NB Please bring a credit / debit card with sufficient funds available to cover this total. We reserve the right to refuse the refund of your reservation fee, in the event of a declined deposit.<br><br> <h3>DAMAGE WAIVER: &#163;80.95</h3> By purchasing a damage waiver, BIKETRAX agree to waiver our claims for minor mechanical damages incurred during your hire, totalling up to 50% of the security deposit total value above. Full terms and conditions are overleaf. This waiver takes the place of a security deposit, and is non-refundable.</p> <p><h1>DECLARATION</h1> I, Haytham A. Al-barrak declare that: <ul> <li>I agree to hire the bicycle and accessories specified above (together, "equipment"), to pay the cost of hire, and I accept the terms in this hire agreement.</li> <li>I agree to have returned the equipment by the date specified above and no later than the time of day at which the equipment was collected. Eg if I collect at 3pm on 13th August 2022 I will return the equipment no later than 3pm on 14th August 2022</li> <li>I acknowledge that no refund will be issued for unused hire time.</li> <li>I accept complete responsibility during the period of hire for the safe custody of the equipment and for any loss, theft or damage (howsoever caused), and I accept that the bike and equipment has been provided in good mechanical condition. I will not make any modification to the hired equipment, and any mechanical work I undertake is done so at my own risk.</li> <li>I am responsible for the security of the bicycle and must lock it to a fixed object whenever unattended and keep the equipment safeguarded at all times.</li> <li>I must return the equipment by the specified time and date. Any loss, theft, damage or accident will be notified to BIKETRAX immediately and in the case of theft or accident to the nearest police station too.<br> <strong>Please retain a copy of this form for identification purposes.</strong></li> <li>I agree to <strong>either</strong>: <ol> <li><strong>Pay a pre-authorised deposit</strong> before hire commences which shall be refunded upon return of the equipment subject to the following terms. The deposit is to be held against any loss, theft, damage or failure to return the equipment by the specified time and date. If not returned by the specified date and time, additional cost of hire shall be charged on a pro rata basis until it is returned. Any late return, replacement or repair costs may be deducted from the deposit. I shall pay any such costs up to but not exceeding the defined security deposit cost for each item, as listed in the list of hire items.</li> <li><strong>Purchase a damage waiver</strong> for which BIKETRAX agree to waiver their claim for minor mechanical damages incurred i.e those <strong>not exceeding 50%</strong> of the specified security deposit total of &#163;1619.00. This does not include theft, loss or late return, which is not covered by this agreement. </li> </ol> </li> <li>I accept that cycling has risks and confirm that I am a competent cyclist. I will not ride if I am in ill health, have a disability likely to affect my ability to cycle, or my eyesight is not up to the standard required by a road driving test. I will not ride under the influence of alcohol, strong medication or other drugs. I understand that it is strongly advised that I wear a helmet and use other appropriate safety equipment and clothing. Front and rear lights are required in hours of reduced light, and these are included free of charge on request.</li> <li>I will follow the highway code, not ride on pavements, against traffic, or more than two abreast.</li> <li>I will not run red lights and be courteous to pedestrians and other road users.</li> <li>I will ride responsibly: not attempt any maneuvers beyond my skill level or the bike's specific capabilities.</li> <li>I accept full responsibility if I ignore any of the above and BIKETRAX are not liable for death or injury to any person or loss or damage to any property that may result. Save in respect of liability for personal injury or death resulting from negligence, the hire company's liability to you whether in contract, tort (including negligence), breach of statutory duty or otherwise is limited to the cost of hire. I agree to indemnify BIKETRAX against any liabilities, costs, expenses, damages and losses arising out of or in connection with the death or injury to any person or any damage to property resulting from my hire or use of the equipment.</li> </ul> <h1>CANCELLATION POLICY</h1> Cancellation 1 calendar month prior to the commencement date of the hire will result in a 75% refund. Cancellation 1 calendar week prior to the commencement date of the hire 50% refund. No Refunds will be given after this time.</p> <p>Signed:<br> <span class="field" data-idx="0" data-name="Please add your ..." data-optional="false" data-options="" data-signee="1" data-type="signature">SIGN HERE</span></p> <p>Haytham A. Al-barrak</p> </body> </html>"



Cheers! I tried to reproduce this on my side, but the value of ibikeRef seems to be correct to me:

Which value exactly do you expect?

Hi @MutedJam!

Yep - it’s very wierd, it successfully extracts the correct value, but as the flow proceeds it truncates it / wipes it. I’ve got a MYSQL and another http node running after, to upload the contract to a eSign service / save it to a local table, and somewhere between the two that value gets truncated / removed, so that {{$json.ibikesRef}} is incorrect or ceases to exist.

It’s like the string is tripping up the code somehow. I can fix it by splitting it, passing in two halves and recombining, which makes me think it is a bug. Maybe in the date detection / string detection algorithm. Obviously it is partly a date, so is there some parsing error?

Tbh, I don’t think I fully understand the problem. So loosing the value doesn’t happen in the part of the workflow you have shared but somewhere else? Could you share a workflow using which the problem can be reproduced?

I’ve just tried to do so - and noticed that If you copy the output data, and then try to repaste it as “pinned data”, you’ll see that n8n is inserting a json formatting error.

That seems like the likely cause.

Oh, so you only have it after manually copying JSON data and then pasting it as pinned data? I believe this is because n8n shows you a simplified version of the JSON data it’s working with internally. Instead of showing you the true JSON string including escape characters (for example <html lang=\"en-GB\" dir=\"ltr\">), you’d get to see a beautified and escaped version of it: <html lang="en-GB" dir="ltr">).

So to make this work you might want to avoid replacing the entire JSON string and just overwrite the individual values you want to use for testing. I’ll also add this to our product team’s backlog for a closer look).

It’s happening when the node is run too - all the other values are making it into my MYSQL table, but i suspect that anything after “data” in alphabetical order is getting tripped up by the error in that field.

here’s the node that is specifically losing the data:

HI @Luke_Austin, I just executed the below workflow:

The {{$json["ibikeRef"]}} value comes through as expected on the server receiving the request:

So I am afraid I’d still need a workflow using which the problem can be reproduced.

No problem - here’s the whole workflow:

Hi @Luke_Austin, I am so sorry but I still am not able to reproduce the problem. Seeing you mentioned that your ibikeRef value disappears after your “Push Contract” node, is there a chance it actually gets overridden by the subsequent Merge node? For example because the “MySQL1” one returns such a key as well?

1 Like

Ooft - that could well be it. What a fool!