I need to chop off a string

I am given a string value of “494.000000”. I want a value of “494”.

The value that comes in is a string, not a number. I just want to remove the dot and everything to the right, leaving the 3 or 4 character string.

No error message, just can’t find a way to do this.

Here is a record as returned.

The fields total_disk and available_disk are the ones I want to truncate.

{
	"devices": {
		"total_disk": "499.0000000000",
		"ActiveManagedUsers": "[]",
		"available_disk": "314.0000000000",
		"CurrentConsoleManagedUser": "brad",
		"date_last_beat": "1709167154",
		"device_name": "BradF MBP",
		"ethernet_mac_address": "3c:22:fb:a1:56:3d",
		"last_lan_ip": "192.168.1.203",
		"os": "mac",
		"osversion": "14.2.1",
		"serial_number": "Random Number",
		"tags": "hrcc,sso",
		"enrollment_type": "GENERAL",
		"installed_memory": "16",
		"device_model_name": "MacBook Pro (16-inch, 2019)"
	}
}

Information on your n8n setup

  • n8n Version: 1.29.1
  • Database (default: SQLite): postgresQL
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker on Digital Ocean
  • Operating system: Ubuntu 22.04

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@russellkg , use {{ parseInt($json.devices.total_disk) }}:

3 Likes

@ihortom, Thank you so much. That did the trick.

-Russ

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.