Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to provide default operation on a number in jolt spec #832

Open
Rishabhadept opened this issue Jul 17, 2019 · 1 comment
Open

How to provide default operation on a number in jolt spec #832

Rishabhadept opened this issue Jul 17, 2019 · 1 comment

Comments

@Rishabhadept
Copy link

Hi,

I want to provide a default operation on a number while transforming it using jolt.
Example: My sample input will be:
{
"NAME":"license",
"PRICE":"5"
}

I want the output to be:
{
"ItemName":"license".
"price":"500"
}

basically, I want to always multiply the price by 100. so It there any way I can define this in my spec?

@wisthy
Copy link

wisthy commented Aug 19, 2019

Here you are. I didn't find the multiply so I divided by 1/100 instead. And the second transformation is to get rid of the decimal part (500.0)

[
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "PRICE": "=divide(@(1,PRICE), 0.01)"
    }
  },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "PRICE": "=toInteger(@(1,PRICE))"
    }
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants