# E!cockpit JSON string, sort data

**URL:** <https://www.wago.community/t/e-cockpit-json-string-sort-data/294>\
**Category:** CODESYS\
**Tags:** ecockpit, codesys\
**Created:** [October 30, 2022, 9:46pm UTC](https://www.wago.community/t/e-cockpit-json-string-sort-data/294 "2022-10-30T21:46:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![espenbo](https://avatars.discourse-cdn.com/v4/letter/e/c57346/32.png) [@espenbo](https://www.wago.community/u/espenbo)\
**Post date:** [November 6, 2022, 1:33pm UTC](https://www.wago.community/t/e-cockpit-json-string-sort-data/294/5 "2022-11-06T13:33:11Z")

</div>

I am continuing to work on this project and have added HMI tables. I also added extra information in typEnergyPrice.  
There I added iArrayPlace to have an overview of where in the array the info is located when I sort from cheap to most expensive. But when I added iArrayPlace then I get weird values in HMI tables

 ![image](https://us1.discourse-cdn.com/flex016/uploads/wago/original/1X/cf80ff162695118b55bcbf856c36a54e0e193f8a.png)  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/wago/original/1X/b3cbb3f2949c07981dbcd225724e37bc8c276e9c.png)

In array 1, 3, 5, etc., I get 125.0 as the value. But when I look in the SortedJsonData Array, I don’t get those values.

When I remove. iArrayPlace : INT;

```auto
TYPE typEnergyPrice :
STRUCT
	NOK_per_kWh : REAL;
	EUR_per_kWh : REAL;
	EXR : REAL;
	time_start : DATE_AND_TIME;
	time_end : DATE_AND_TIME;
	NOK_per_kWh_mva : REAL;
//	iArrayPlace : INT;
END_STRUCT
END_TYPE

```

AND the sorthing in HTTP\_HvaKosterStrommen. I get the right vaules in tables inn HMI.

```auto
// Add array placement in array	
//	FOR i := 0 TO (n) DO
// SortedJsonData[i].iArrayPlace := i;
//	END_FOR

```

I have tride to delete the tables in HMI and add it back. But I get the same result.

[Code at GitLab](https://gitlab.com/espenbo/Codesys_JSON_hvakosterstrommen)

---

_[View the full topic](https://www.wago.community/t/e-cockpit-json-string-sort-data/294)._
