简体   繁体   中英

Can Jinja print a negative decimal number with more than 2 decimal places?

I've got an API call that's returning the following JSON:

{
    "account_id": "accountID",
    "processed_length": 41,
    "sentiment": "NEGATIVE",
    "sentiment_score": -0.800000011920929,
    "text": "This is the worst possible solution ever."
}

I'm trying to print sentiment_score as its current value but {{sentiment_score}} is printing as 0. {{sentiment_score|float}} printed as 0.0. How can I get the full value and that it's negative in Jinja? {{sentiment}} and {{text}} are printing their values just fine.

I was able to get it to show the minus sign by using {{0 + sentiment_score}}.

I didn't have the problem of truncated numbers though.

I was able to get the value to print properly in QuickBase Pipelines by just using the output value from the Iterate over JSON step. 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM