Recent

Author Topic: [SOLVED] JSON and duplicate object  (Read 6785 times)

DanishMale

  • Jr. Member
  • **
  • Posts: 94
[SOLVED] JSON and duplicate object
« on: August 21, 2025, 08:17:14 am »
 Hi all,

I have a function which creates this JSON string:

Code: Text  [Select][+][-]
  1. {
  2.   "state": "success",
  3.   "message": "",
  4.   "datatype": "epg",
  5.   "supplier": "MoviStar+ ES",
  6.   "channel": "mliga",
  7.   "channelname": "M+ LALIGA",
  8.   "epg": [
  9.     {
  10.       "name": "LALIGA HYPERMOTION (T25/26): Almería - Albacete",
  11.       "start": "2025-08-20 05:31:00",
  12.       "genre": "Deportes",
  13.       "end": "2025-08-20 07:25:00",
  14.       "duration": "114",
  15.       "description": "",
  16.       "season": "0",
  17.       "episode": "0",
  18.       "year": "0"
  19.     },
  20.     {
  21.       "name": "Resúmenes LALIGA HyperMotion (T25/26): Sporting - Córdoba",
  22.       "start": "2025-08-20 07:25:00",
  23.       "genre": "Deportes",
  24.       "end": "2025-08-20 07:30:00",
  25.       "duration": "5",
  26.       "description": "",
  27.       "season": "0",
  28.       "episode": "0",
  29.       "year": "0"
  30.     },
  31.     {
  32.       "name": "Resúmenes LALIGA HyperMotion (T25/26): Málaga - Eibar",
  33.       "start": "2025-08-20 07:30:00",
  34.       "genre": "Deportes",
  35.       "end": "2025-08-20 07:35:00",
  36.       "duration": "5",
  37.       "description": "",
  38.       "season": "0",
  39.       "episode": "0",
  40.       "year": "0"
  41.     },
  42.     {
  43.       "name": "Resúmenes LALIGA HyperMotion (T25/26): Real Sociedad B - Zaragoza",
  44.       "start": "2025-08-20 07:35:00",
  45.       "genre": "Deportes",
  46.       "end": "2025-08-20 07:47:00",
  47.       "duration": "12",
  48.       "description": "",
  49.       "season": "0",
  50.       "episode": "0",
  51.       "year": "0"
  52.     },
  53.     {
  54.       "name": "Resúmenes LALIGA HyperMotion (T25/26): Cádiz - Mirandés",
  55.       "start": "2025-08-20 07:47:00",
  56.       "genre": "Deportes",
  57.       "end": "2025-08-20 07:53:00",
  58.       "duration": "6",
  59.       "description": "",
  60.       "season": "0",
  61.       "episode": "0",
  62.       "year": "0"
  63.     },
  64.     {
  65.       "name": "Resúmenes LALIGA HyperMotion (T25/26): Huesca - Leganés",
  66.       "start": "2025-08-20 07:53:00",
  67.       "genre": "Deportes",
  68.       "end": "2025-08-20 08:00:00",
  69.       "duration": "7",
  70.       "description": "",
  71.       "season": "0",
  72.       "episode": "0",
  73.       "year": "0"
  74.     },
  75.     {
  76.       "name": "LALIGA HYPERMOTION (T25/26): Granada - Deportivo",
  77.       "start": "2025-08-20 08:00:00",
  78.       "genre": "Deportes",
  79.       "end": "2025-08-20 09:50:00",
  80.       "duration": "110",
  81.       "description": "",
  82.       "season": "0",
  83.       "episode": "0",
  84.       "year": "0"
  85.     },
  86.     {
  87.       "name": "Resúmenes LALIGA HyperMotion (T25/26): Sporting - Córdoba",
  88.       "start": "2025-08-20 09:50:00",
  89.       "genre": "Deportes",
  90.       "end": "2025-08-20 09:57:00",
  91.       "duration": "7",
  92.       "description": "",
  93.       "season": "0",
  94.       "episode": "0",
  95.       "year": "0"
  96.     },
  97.     {
  98.       "name": "LALIGA EA SPORTS (T25/26): Espanyol - At. Madrid",
  99.       "start": "2025-08-20 09:57:00",
  100.       "genre": "Deportes",
  101.       "end": "2025-08-20 11:43:00",
  102.       "duration": "106",
  103.       "description": "",
  104.       "season": "0",
  105.       "episode": "0",
  106.       "year": "0"
  107.     },
  108.     {
  109.       "name": "Resúmenes LALIGA EA Sports (T25/26): Athletic - Sevilla",
  110.       "start": "2025-08-20 11:43:00",
  111.       "genre": "Deportes",
  112.       "end": "2025-08-20 11:56:00",
  113.       "duration": "13",
  114.       "description": "",
  115.       "season": "0",
  116.       "episode": "0",
  117.       "year": "0"
  118.     },
  119.     {
  120.       "name": "Informe Plus+. Pibe Muniain",
  121.       "start": "2025-08-20 11:56:00",
  122.       "genre": "Deportes",
  123.       "end": "2025-08-20 12:46:00",
  124.       "duration": "50",
  125.       "description": "",
  126.       "season": "0",
  127.       "episode": "0",
  128.       "year": "0"
  129.     },
  130.     {
  131.       "name": "LALIGA HYPERMOTION (T25/26): Sporting - Córdoba",
  132.       "start": "2025-08-20 12:46:00",
  133.       "genre": "Deportes",
  134.       "end": "2025-08-20 14:41:00",
  135.       "duration": "115",
  136.       "description": "",
  137.       "season": "0",
  138.       "episode": "0",
  139.       "year": "0"
  140.     },
  141.     {
  142.       "name": "Resúmenes LALIGA EA Sports (T25/26): Real Madrid - Osasuna",
  143.       "start": "2025-08-20 14:41:00",
  144.       "genre": "Deportes",
  145.       "end": "2025-08-20 14:55:00",
  146.       "duration": "14",
  147.       "description": "",
  148.       "season": "0",
  149.       "episode": "0",
  150.       "year": "0"
  151.     },
  152.     {
  153.       "name": "Universo Valdano (T8): Mikel Arteta",
  154.       "start": "2025-08-20 14:55:00",
  155.       "genre": "Deportes",
  156.       "end": "2025-08-20 15:52:00",
  157.       "duration": "57",
  158.       "description": "",
  159.       "season": "0",
  160.       "episode": "0",
  161.       "year": "0"
  162.     },
  163.     {
  164.       "name": "LALIGA EA SPORTS (T25/26): Elche - Betis",
  165.       "start": "2025-08-20 15:52:00",
  166.       "genre": "Deportes",
  167.       "end": "2025-08-20 17:38:00",
  168.       "duration": "106",
  169.       "description": "",
  170.       "season": "0",
  171.       "episode": "0",
  172.       "year": "0"
  173.     },
  174.     {
  175.       "name": "Resúmenes LALIGA EA Sports (T25/26): Celta - Getafe",
  176.       "start": "2025-08-20 17:38:00",
  177.       "genre": "Deportes",
  178.       "end": "2025-08-20 17:52:00",
  179.       "duration": "14",
  180.       "description": "",
  181.       "season": "0",
  182.       "episode": "0",
  183.       "year": "0"
  184.     },
  185.     {
  186.       "name": "Informe Plus+. Pepe Reina: La última parada",
  187.       "start": "2025-08-20 17:52:00",
  188.       "genre": "Deportes",
  189.       "end": "2025-08-20 18:53:00",
  190.       "duration": "61",
  191.       "description": "",
  192.       "season": "0",
  193.       "episode": "0",
  194.       "year": "0"
  195.     },
  196.     {
  197.       "name": "LALIGA EA SPORTS (T25/26): Mallorca - FC Barcelona",
  198.       "start": "2025-08-20 18:53:00",
  199.       "genre": "Deportes",
  200.       "end": "2025-08-20 20:50:00",
  201.       "duration": "117",
  202.       "description": "",
  203.       "season": "0",
  204.       "episode": "0",
  205.       "year": "0"
  206.     },
  207.     {
  208.       "name": "Resúmenes LALIGA EA Sports (T25/26): Real Madrid - Osasuna",
  209.       "start": "2025-08-20 20:50:00",
  210.       "genre": "Deportes",
  211.       "end": "2025-08-20 21:05:00",
  212.       "duration": "15",
  213.       "description": "",
  214.       "season": "0",
  215.       "episode": "0",
  216.       "year": "0"
  217.     },
  218.     {
  219.       "name": "Informe Plus+. Iago Aspas. Corazón celeste",
  220.       "start": "2025-08-20 21:05:00",
  221.       "genre": "Deportes",
  222.       "end": "2025-08-20 21:53:00",
  223.       "duration": "48",
  224.       "description": "",
  225.       "season": "0",
  226.       "episode": "0",
  227.       "year": "0"
  228.     },
  229.     {
  230.       "name": "Luis Aragonés, la huella de un sabio",
  231.       "start": "2025-08-20 21:53:00",
  232.       "genre": "Deportes",
  233.       "end": "2025-08-20 23:00:00",
  234.       "duration": "67",
  235.       "description": "",
  236.       "season": "0",
  237.       "episode": "0",
  238.       "year": "0"
  239.     },
  240.     {
  241.       "name": "LALIGA EA SPORTS (T25/26): Espanyol - At. Madrid",
  242.       "start": "2025-08-20 23:00:00",
  243.       "genre": "Deportes",
  244.       "end": "2025-08-21 00:54:00",
  245.       "duration": "114",
  246.       "description": "",
  247.       "season": "0",
  248.       "episode": "0",
  249.       "year": "0"
  250.     },
  251.     {
  252.       "name": "Resúmenes LALIGA EA Sports (T25/26): Alavés - Levante",
  253.       "start": "2025-08-21 00:54:00",
  254.       "genre": "Deportes",
  255.       "end": "2025-08-21 01:08:00",
  256.       "duration": "14",
  257.       "description": "",
  258.       "season": "0",
  259.       "episode": "0",
  260.       "year": "0"
  261.     },
  262.     {
  263.       "name": "LALIGA HYPERMOTION (T25/26): Almería - Albacete",
  264.       "start": "2025-08-21 01:08:00",
  265.       "genre": "Deportes",
  266.       "end": "2025-08-21 03:03:00",
  267.       "duration": "115",
  268.       "description": "",
  269.       "season": "0",
  270.       "episode": "0",
  271.       "year": "0"
  272.     },
  273.     {
  274.       "name": "Especiales LaLiga (T24/25): Los goles de Raphinha",
  275.       "start": "2025-08-21 03:03:00",
  276.       "genre": "Deportes",
  277.       "end": "2025-08-21 03:16:00",
  278.       "duration": "13",
  279.       "description": "",
  280.       "season": "0",
  281.       "episode": "0",
  282.       "year": "0"
  283.     },
  284.     {
  285.       "name": "LALIGA EA SPORTS (T25/26): Valencia - R. Sociedad",
  286.       "start": "2025-08-21 03:16:00",
  287.       "genre": "Deportes",
  288.       "end": "2025-08-21 05:08:00",
  289.       "duration": "112",
  290.       "description": "",
  291.       "season": "0",
  292.       "episode": "0",
  293.       "year": "0"
  294.     },
  295.     {
  296.       "name": "Resúmenes LALIGA EA Sports (T25/26): Athletic - Sevilla",
  297.       "start": "2025-08-21 05:08:00",
  298.       "genre": "Deportes",
  299.       "end": "2025-08-21 05:22:00",
  300.       "duration": "14",
  301.       "description": "",
  302.       "season": "0",
  303.       "episode": "0",
  304.       "year": "0"
  305.     },
  306.     {
  307.       "name": "LALIGA HYPERMOTION (T25/26): Las Palmas - Andorra",
  308.       "start": "2025-08-21 05:22:00",
  309.       "genre": "Deportes",
  310.       "end": "2025-08-21 05:22:00",
  311.       "duration": "0",
  312.       "description": "",
  313.       "season": "0",
  314.       "episode": "0",
  315.       "year": "0"
  316.     }
  317.   ]
  318. }

and when I run this piece of code

Code: Pascal  [Select][+][-]
  1.   Sl := TStringList.Create;
  2.   Sl.Clear;
  3.   Sl.Add(EPGJSONstr);
  4.   Sl.SaveToFile('check file.log');
  5.   SupplierJSON := GetJSON(EPGJSONstr,True);
  6.   Sl.Add(SupplierJSON.AsJSON);
  7.   Sl.SaveToFile('check file.log');
  8.   Sl.Free;
  9.  

it returns the error : Duplicate object member : "description"

HOWEVER, when I run this JSON string :

Code: Text  [Select][+][-]
  1. {
  2.   "state": "success",
  3.   "message": "",
  4.   "datatype": "epg",
  5.   "supplier": "MoviStar+ ES",
  6.   "channel": "mligs",
  7.   "channelname": "LALIGA TV HYPERMOTION",
  8.   "epg": [
  9.     {
  10.       "name": "LALIGA TV HYPERMOTION",
  11.       "start": "2025-08-21 06:00:00",
  12.       "genre": "",
  13.       "end": "2025-08-21 10:00:00",
  14.       "duration": "240",
  15.       "season": "0",
  16.       "episode": "0",
  17.       "description": "",
  18.       "year": "0"
  19.     },
  20.     {
  21.       "name": "LALIGA TV HYPERMOTION",
  22.       "start": "2025-08-21 10:00:00",
  23.       "genre": "",
  24.       "end": "2025-08-21 14:00:00",
  25.       "duration": "240",
  26.       "season": "0",
  27.       "episode": "0",
  28.       "description": "",
  29.       "year": "0"
  30.     },
  31.     {
  32.       "name": "LALIGA TV HYPERMOTION",
  33.       "start": "2025-08-21 14:00:00",
  34.       "genre": "",
  35.       "end": "2025-08-21 18:00:00",
  36.       "duration": "240",
  37.       "season": "0",
  38.       "episode": "0",
  39.       "description": "",
  40.       "year": "0"
  41.     },
  42.     {
  43.       "name": "LALIGA TV HYPERMOTION",
  44.       "start": "2025-08-21 18:00:00",
  45.       "genre": "",
  46.       "end": "2025-08-21 22:00:00",
  47.       "duration": "240",
  48.       "season": "0",
  49.       "episode": "0",
  50.       "description": "",
  51.       "year": "0"
  52.     },
  53.     {
  54.       "name": "LALIGA TV HYPERMOTION",
  55.       "start": "2025-08-21 22:00:00",
  56.       "genre": "",
  57.       "end": "2025-08-22 06:00:00",
  58.       "duration": "480",
  59.       "season": "0",
  60.       "episode": "0",
  61.       "description": "",
  62.       "year": "0"
  63.     },
  64.     {
  65.       "name": "LALIGA TV HYPERMOTION",
  66.       "start": "2025-08-22 02:00:00",
  67.       "genre": "",
  68.       "end": "2025-08-22 06:00:00",
  69.       "duration": "240",
  70.       "season": "0",
  71.       "episode": "0",
  72.       "description": "",
  73.       "year": "0"
  74.     }
  75.   ]
  76. }
  77.  

there is NO error

Any help is really appreciated and thanks in advance
« Last Edit: August 22, 2025, 05:29:25 pm by DanishMale »
Lazarus 4.6 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenViX 6.7.015 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 12.0.2 x64 | SQLite 3.40.0 x64

Zvoni

  • Hero Member
  • *****
  • Posts: 3369
Re: JSON and duplicate object
« Reply #1 on: August 21, 2025, 08:36:19 am »
Quote
"name": "LALIGA HYPERMOTION (T25/26): Almería - Albacete",
You have to escape the forward-slash since it has special meaning in JSON

-->
Quote
"name": "LALIGA HYPERMOTION (T25\/26): Almería - Albacete",
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

DanishMale

  • Jr. Member
  • **
  • Posts: 94
Re: JSON and duplicate object
« Reply #2 on: August 21, 2025, 08:58:21 am »
Quote
"name": "LALIGA HYPERMOTION (T25/26): Almería - Albacete",
You have to escape the forward-slash since it has special meaning in JSON

-->
Quote
"name": "LALIGA HYPERMOTION (T25\/26): Almería - Albacete",

I have added so forward slashes will escaped and it still have the same error  :'(
Lazarus 4.6 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenViX 6.7.015 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 12.0.2 x64 | SQLite 3.40.0 x64

Khrys

  • Sr. Member
  • ****
  • Posts: 436
Re: JSON and duplicate object
« Reply #3 on: August 21, 2025, 09:17:15 am »
You have to escape the forward-slash since it has special meaning in JSON

In JSON forward slashes can be escaped, but they don't need to be escaped - they have no special meaning:

Quote from: RFC 7159 - The JavaScript Object Notation (JSON) Data Interchange Format
All Unicode characters may be placed within the quotation marks, except for the characters that must be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F).



I can't reproduce this error... how exactly do you load the string into  EPGJSONstr? Did you check whether  EPGJSONstr  does in fact contain the JSON you posted before calling  GetJSON?

Zvoni

  • Hero Member
  • *****
  • Posts: 3369
Re: JSON and duplicate object
« Reply #4 on: August 21, 2025, 09:22:28 am »
You have to escape the forward-slash since it has special meaning in JSON

In JSON forward slashes can be escaped, but they don't need to be escaped - they have no special meaning:

OK, accepted. Probably found a "wrong" website.

but i see something else, which is different between his 2 JSON's:

Quote
"name": "LALIGA HYPERMOTION (T25/26): Almería - Albacete",
That's Unicode, right?
Is his Problem maybe an encoding-issue?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

DanishMale

  • Jr. Member
  • **
  • Posts: 94
Re: JSON and duplicate object
« Reply #5 on: August 21, 2025, 09:31:06 am »
You have to escape the forward-slash since it has special meaning in JSON

In JSON forward slashes can be escaped, but they don't need to be escaped - they have no special meaning:

Quote from: RFC 7159 - The JavaScript Object Notation (JSON) Data Interchange Format
All Unicode characters may be placed within the quotation marks, except for the characters that must be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F).



I can't reproduce this error... how exactly do you load the string into  EPGJSONstr? Did you check whether  EPGJSONstr  does in fact contain the JSON you posted before calling  GetJSON?

I get it like this : EPGJSONstr := FunctionEPG(ChannelsJSONstr,EPGJSONstr, Now());
Lazarus 4.6 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenViX 6.7.015 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 12.0.2 x64 | SQLite 3.40.0 x64

Khrys

  • Sr. Member
  • ****
  • Posts: 436
Re: JSON and duplicate object
« Reply #6 on: August 21, 2025, 09:43:38 am »
I get it like this : EPGJSONstr := FunctionEPG(ChannelsJSONstr,EPGJSONstr, Now());

This doesn't help.. how are we supposed to know what  FunctionEPG does?

Here's another suggestion: insert the following line...

Code: Pascal  [Select][+][-]
  1. with TStringList.Create() do begin Text := EPGJSONstr; SaveToFile('example.json'); Free(); end;

...right before this line...

Code: Pascal  [Select][+][-]
  1. SupplierJSON := GetJSON(EPGJSONstr,True);

...and then look at  example.json  after recompiling & running the program.
This is what the JSON parser actually gets to see, and I'm willing to bet that it doesn't contain valid JSON.

DanishMale

  • Jr. Member
  • **
  • Posts: 94
Re: JSON and duplicate object
« Reply #7 on: August 21, 2025, 12:12:09 pm »
I get it like this : EPGJSONstr := FunctionEPG(ChannelsJSONstr,EPGJSONstr, Now());

This doesn't help.. how are we supposed to know what  FunctionEPG does?

Here's another suggestion: insert the following line...

Code: Pascal  [Select][+][-]
  1. with TStringList.Create() do begin Text := EPGJSONstr; SaveToFile('example.json'); Free(); end;

What is the difference with the method I am using ?

Quote
...right before this line...

Code: Pascal  [Select][+][-]
  1. SupplierJSON := GetJSON(EPGJSONstr,True);

...and then look at  example.json  after recompiling & running the program.
This is what the JSON parser actually gets to see, and I'm willing to bet that it doesn't contain valid JSON.


FunctionEPG uses IdHTTP to grab basicdata which are in JSON format and converts these data to a unified data rule in JSON format at the receiving unit

and is called

EPGJSONstr := FunctionEPG('Channel Name','Channel ID', Now());

Then I have tried to take copied text in Sl.Text and convert this to JSON still same error, however the other sample works as expected
« Last Edit: August 21, 2025, 12:23:05 pm by DanishMale »
Lazarus 4.6 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenViX 6.7.015 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 12.0.2 x64 | SQLite 3.40.0 x64

DanishMale

  • Jr. Member
  • **
  • Posts: 94
Re: JSON and duplicate object
« Reply #8 on: August 21, 2025, 12:27:27 pm »
@Khrys

Here is the result with your suggestion:

Code: Pascal  [Select][+][-]
  1.  with TStringList.Create() do begin Text := EPGJSONstr; SaveToFile('example.json'); Free(); end;

Code: Text  [Select][+][-]
  1. {
  2.   "state": "success",
  3.   "message": "",
  4.   "datatype": "epg",
  5.   "supplier": "MoviStar+ ES",
  6.   "channel": "mliga",
  7.   "channelname": "M+ LALIGA",
  8.   "epg": [
  9.     {
  10.       "name": "LALIGA HYPERMOTION (T25/26): Las Palmas - Andorra",
  11.       "start": "2025-08-21 05:22:00",
  12.       "genre": "Deportes",
  13.       "end": "2025-08-21 07:20:00",
  14.       "duration": "118",
  15.       "description": "",
  16.       "season": "0",
  17.       "episode": "0",
  18.       "year": "0"
  19.     },
  20.     {
  21.       "name": "Resúmenes LALIGA EA Sports (T25/26): Celta - Getafe",
  22.       "start": "2025-08-21 07:20:00",
  23.       "genre": "Deportes",
  24.       "end": "2025-08-21 07:32:00",
  25.       "duration": "12",
  26.       "description": "",
  27.       "season": "0",
  28.       "episode": "0",
  29.       "year": "0"
  30.     },
  31.     {
  32.       "name": "Resúmenes LALIGA EA Sports (T25/26): Athletic - Sevilla",
  33.       "start": "2025-08-21 07:32:00",
  34.       "genre": "Deportes",
  35.       "end": "2025-08-21 07:44:00",
  36.       "duration": "12",
  37.       "description": "",
  38.       "season": "0",
  39.       "episode": "0",
  40.       "year": "0"
  41.     },
  42.     {
  43.       "name": "Resúmenes LALIGA EA Sports (T25/26): Real Madrid - Osasuna",
  44.       "start": "2025-08-21 07:44:00",
  45.       "genre": "Deportes",
  46.       "end": "2025-08-21 08:00:00",
  47.       "duration": "16",
  48.       "description": "",
  49.       "season": "0",
  50.       "episode": "0",
  51.       "year": "0"
  52.     },
  53.     {
  54.       "name": "Informe Plus+. Pibe Muniain",
  55.       "start": "2025-08-21 08:00:00",
  56.       "genre": "Deportes",
  57.       "end": "2025-08-21 08:55:00",
  58.       "duration": "55",
  59.       "description": "",
  60.       "season": "0",
  61.       "episode": "0",
  62.       "year": "0"
  63.     },
  64.     {
  65.       "name": "Resúmenes LALIGA HyperMotion (T25/26): Cádiz - Mirandés",
  66.       "start": "2025-08-21 08:55:00",
  67.       "genre": "Deportes",
  68.       "end": "2025-08-21 09:05:00",
  69.       "duration": "10",
  70.       "description": "",
  71.       "season": "0",
  72.       "episode": "0",
  73.       "year": "0"
  74.     },
  75.     {
  76.       "name": "LALIGA EA SPORTS (T25/26): Elche - Betis",
  77.       "start": "2025-08-21 09:05:00",
  78.       "genre": "Deportes",
  79.       "end": "2025-08-21 10:50:00",
  80.       "duration": "105",
  81.       "description": "",
  82.       "season": "0",
  83.       "episode": "0",
  84.       "year": "0"
  85.     },
  86.     {
  87.       "name": "Resúmenes LALIGA EA Sports (T25/26): Celta - Getafe",
  88.       "start": "2025-08-21 10:50:00",
  89.       "genre": "Deportes",
  90.       "end": "2025-08-21 11:05:00",
  91.       "duration": "15",
  92.       "description": "",
  93.       "season": "0",
  94.       "episode": "0",
  95.       "year": "0"
  96.     },
  97.     {
  98.       "name": "Universo Valdano (T8): Mikel Arteta",
  99.       "start": "2025-08-21 11:05:00",
  100.       "genre": "Deportes",
  101.       "end": "2025-08-21 12:05:00",
  102.       "duration": "60",
  103.       "description": "",
  104.       "season": "0",
  105.       "episode": "0",
  106.       "year": "0"
  107.     },
  108.     {
  109.       "name": "LALIGA HYPERMOTION (T25/26): Almería - Albacete",
  110.       "start": "2025-08-21 12:05:00",
  111.       "genre": "Deportes",
  112.       "end": "2025-08-21 14:02:00",
  113.       "duration": "117",
  114.       "description": "",
  115.       "season": "0",
  116.       "episode": "0",
  117.       "year": "0"
  118.     },
  119.     {
  120.       "name": "Resúmenes LALIGA HyperMotion (T25/26): Valladolid - Ceuta",
  121.       "start": "2025-08-21 14:02:00",
  122.       "genre": "Deportes",
  123.       "end": "2025-08-21 14:13:00",
  124.       "duration": "11",
  125.       "description": "",
  126.       "season": "0",
  127.       "episode": "0",
  128.       "year": "0"
  129.     },
  130.     {
  131.       "name": "Informe Plus+. Pepe Reina: La última parada",
  132.       "start": "2025-08-21 14:13:00",
  133.       "genre": "Deportes",
  134.       "end": "2025-08-21 15:17:00",
  135.       "duration": "64",
  136.       "description": "",
  137.       "season": "0",
  138.       "episode": "0",
  139.       "year": "0"
  140.     },
  141.     {
  142.       "name": "LALIGA EA SPORTS (T25/26): Valencia - R. Sociedad",
  143.       "start": "2025-08-21 15:17:00",
  144.       "genre": "Deportes",
  145.       "end": "2025-08-21 17:10:00",
  146.       "duration": "113",
  147.       "description": "",
  148.       "season": "0",
  149.       "episode": "0",
  150.       "year": "0"
  151.     },
  152.     {
  153.       "name": "Resúmenes LALIGA EA Sports (T25/26): Athletic - Sevilla",
  154.       "start": "2025-08-21 17:10:00",
  155.       "genre": "Deportes",
  156.       "end": "2025-08-21 17:25:00",
  157.       "duration": "15",
  158.       "description": "",
  159.       "season": "0",
  160.       "episode": "0",
  161.       "year": "0"
  162.     },
  163.     {
  164.       "name": "Informe Plus+. Iago Aspas. Corazón celeste",
  165.       "start": "2025-08-21 17:25:00",
  166.       "genre": "Deportes",
  167.       "end": "2025-08-21 18:15:00",
  168.       "duration": "50",
  169.       "description": "",
  170.       "season": "0",
  171.       "episode": "0",
  172.       "year": "0"
  173.     },
  174.     {
  175.       "name": "Resúmenes LALIGA EA Sports (T25/26): Celta - Getafe",
  176.       "start": "2025-08-21 18:15:00",
  177.       "genre": "Deportes",
  178.       "end": "2025-08-21 18:29:00",
  179.       "duration": "14",
  180.       "description": "",
  181.       "season": "0",
  182.       "episode": "0",
  183.       "year": "0"
  184.     },
  185.     {
  186.       "name": "LALIGA EA SPORTS (T25/26): Espanyol - At. Madrid",
  187.       "start": "2025-08-21 18:29:00",
  188.       "genre": "Deportes",
  189.       "end": "2025-08-21 20:23:00",
  190.       "duration": "114",
  191.       "description": "",
  192.       "season": "0",
  193.       "episode": "0",
  194.       "year": "0"
  195.     },
  196.     {
  197.       "name": "Luis Aragonés, la huella de un sabio",
  198.       "start": "2025-08-21 20:23:00",
  199.       "genre": "Deportes",
  200.       "end": "2025-08-21 21:30:00",
  201.       "duration": "67",
  202.       "description": "",
  203.       "season": "0",
  204.       "episode": "0",
  205.       "year": "0"
  206.     },
  207.     {
  208.       "name": "Noche de Bienvenida 2025",
  209.       "start": "2025-08-21 21:30:00",
  210.       "genre": "Deportes",
  211.       "end": "2025-08-21 23:05:00",
  212.       "duration": "95",
  213.       "description": "",
  214.       "season": "0",
  215.       "episode": "0",
  216.       "year": "0"
  217.     },
  218.     {
  219.       "name": "Soy Leyenda (T1): El Cholo Simeone",
  220.       "start": "2025-08-21 23:05:00",
  221.       "genre": "Deportes",
  222.       "end": "2025-08-22 00:00:00",
  223.       "duration": "55",
  224.       "description": "",
  225.       "season": "0",
  226.       "episode": "0",
  227.       "year": "0"
  228.     },
  229.     {
  230.       "name": "LALIGA EA SPORTS (T25/26): Valencia - R. Sociedad",
  231.       "start": "2025-08-22 00:00:00",
  232.       "genre": "Deportes",
  233.       "end": "2025-08-22 01:52:00",
  234.       "duration": "112",
  235.       "description": "",
  236.       "season": "0",
  237.       "episode": "0",
  238.       "year": "0"
  239.     },
  240.     {
  241.       "name": "Resúmenes LALIGA EA Sports (T25/26): Athletic - Sevilla",
  242.       "start": "2025-08-22 01:52:00",
  243.       "genre": "Deportes",
  244.       "end": "2025-08-22 02:06:00",
  245.       "duration": "14",
  246.       "description": "",
  247.       "season": "0",
  248.       "episode": "0",
  249.       "year": "0"
  250.     },
  251.     {
  252.       "name": "LALIGA HYPERMOTION (T25/26): Las Palmas - Andorra",
  253.       "start": "2025-08-22 02:06:00",
  254.       "genre": "Deportes",
  255.       "end": "2025-08-22 06:00:00",
  256.       "duration": "234",
  257.       "description": "",
  258.       "season": "0",
  259.       "episode": "0",
  260.       "year": "0"
  261.     },
  262.     {
  263.       "name": "LALIGA EA SPORTS (T25/26): Espanyol - At. Madrid",
  264.       "start": "2025-08-22 04:05:00",
  265.       "genre": "Deportes",
  266.       "end": "2025-08-22 06:00:00",
  267.       "duration": "115",
  268.       "description": "",
  269.       "season": "0",
  270.       "episode": "0",
  271.       "year": "0"
  272.     }
  273.   ]
  274. }
Lazarus 4.6 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenViX 6.7.015 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 12.0.2 x64 | SQLite 3.40.0 x64

wp

  • Hero Member
  • *****
  • Posts: 13511
Re: JSON and duplicate object
« Reply #9 on: August 21, 2025, 03:13:54 pm »
I have a function which creates this JSON string:
[...]
and when I run this piece of code
[...]
there is NO error
If you'd have posted a complete, compilable project (*) I could just have checked your issue immediately. With the snippets provided I had to create a project of my own - too many things that I could do differently from what you were doing. In the attachment there is the project that I created, the ButtonClick handler executes your code - no issues at all (Laz/main + fpc3.2.2, or Laz 2.0.12 + fpc 3.2.0, on Windows 11)...

(*) NB: But this does not mean that you should post you current project - it's a lot of work to debug the projects of others and make the bug appear. Just reduce everything so that only the bug is left and post this reduced project.

DanishMale

  • Jr. Member
  • **
  • Posts: 94
Re: JSON and duplicate object
« Reply #10 on: August 21, 2025, 03:45:28 pm »
I have a function which creates this JSON string:
[...]
and when I run this piece of code
[...]
there is NO error
If you'd have posted a complete, compilable project (*) I could just have checked your issue immediately. With the snippets provided I had to create a project of my own - too many things that I could do differently from what you were doing. In the attachment there is the project that I created, the ButtonClick handler executes your code - no issues at all (Laz/main + fpc3.2.2, or Laz 2.0.12 + fpc 3.2.0, on Windows 11)...

(*) NB: But this does not mean that you should post you current project - it's a lot of work to debug the projects of others and make the bug appear. Just reduce everything so that only the bug is left and post this reduced project.

I have zipped the files in use for creating the JSON data etc.... and attached them here  .. It is NOT the complete project
Lazarus 4.6 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenViX 6.7.015 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 12.0.2 x64 | SQLite 3.40.0 x64

DanishMale

  • Jr. Member
  • **
  • Posts: 94
Re: [SOLVED] JSON and duplicate object
« Reply #11 on: August 22, 2025, 05:31:22 pm »
Hi all

Thank you very much for your effort and input  :D

I took the consequence and rewrote the function and that solved my problem ....

This is a great forum and nice to have so many who take part in one creations
Lazarus 4.6 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenViX 6.7.015 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 12.0.2 x64 | SQLite 3.40.0 x64

 

TinyPortal © 2005-2018