# How to preprocess json\_v2 with one timestamp for an array of values

**URL:** <https://community.influxdata.com/t/how-to-preprocess-json-v2-with-one-timestamp-for-an-array-of-values/30288>\
**Category:** Telegraf\
**Tags:** telegraf\
**Created:** [June 14, 2023, 11:16am UTC](https://community.influxdata.com/t/how-to-preprocess-json-v2-with-one-timestamp-for-an-array-of-values/30288 "2023-06-14T11:16:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicomigenda](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@nicomigenda](https://community.influxdata.com/u/nicomigenda)\
**Post date:** [June 14, 2023, 11:16am UTC](https://community.influxdata.com/t/how-to-preprocess-json-v2-with-one-timestamp-for-an-array-of-values/30288/1 "2023-06-14T11:16:50Z")

</div>

Hello,

I am running into problem processing our internal json data with telegraf and influxdb.  
The data package looks the following:  
{  
“meta”: {  
“sensor”: “VoltageL1”,  
“normalized”: true,  
“unit”: “V”,  
“range”: 1000,  
“maximum”: 1.0,  
“sampletime”: 10000,  
“numVal”: 1000  
},  
“starttime”: 133312145513450000,  
“values”: [  
229.692,  
229.692,  
229.692,  
…  
(truncated for brevity)  
…  
229.761,  
229.761,  
229.761,  
229.761,  
229.761  
]  
}  
Is it possible to directly preprocess the timestamp with the given sampletime (1ms increment) in telegraf to save with the following format to influxdb  
{“starttime”: 133312145513450000, “value”: 229.761},  
{“starttime”: 133312145513450000, “value”: 229.761}, …

How would the resulting mqtt\_consumer look like?  
Thanks for any help in advance.

---

<div class="post-metadata">

**Author:** ![jpowers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jpowers/32/8569_2.png) [@jpowers](https://community.influxdata.com/u/jpowers)\
**Post date:** [June 14, 2023, 8:17pm UTC](https://community.influxdata.com/t/how-to-preprocess-json-v2-with-one-timestamp-for-an-array-of-values/30288/2 "2023-06-14T20:17:05Z")

</div>

> 133312145513450000

This is 18-digits long. A typical nanosecond timestamp is 19-digits. It is probably not what you want. The current millisecond timestamp is 1686773738629, or 13-digits.

In any case, when you parse your JSON you can need to:

1. Set the precision of the agent or the input to `ms`
2. If parsing the JSON use the `json_time_format = "unix_ms"` option
