Recent

Author Topic: JSON object to URL  (Read 2415 times)

Dane

  • New Member
  • *
  • Posts: 15
JSON object to URL
« on: March 21, 2018, 08:25:36 am »
Hi!
There are many topics how to parse JSON object from web response. But I've need to convert JSON object to URL string. An example:
from
{ order: { "DATE_CREATE": "ASC" }, filter: { "NAME": "some", "PHONE": {"VALUE" : "1234", "TYPE" : "somewhere"} }, select: [ "ID", "NAME", "LAST_NAME", "PHONE", "EMAIL" ] }
to
order[DATE_CREATE]=ASC&filter[NAME]=some&filter[PHONE][VALUE]=1234&filter[PHONE][TYPE]=somewhere&select[0]=ID&select[1]=NAME&select[2]=LAST_NAME&select[3]=PHONE&select[4]=EMAIL

I'll be thankful for help or links...
« Last Edit: March 27, 2018, 12:25:15 pm by Dane »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: JSON object to URL
« Reply #1 on: March 21, 2018, 02:39:32 pm »
I'll be thankful for help or links...
Starting points:
http://wiki.freepascal.org/fcl-json
https://www.freepascal.org/docs-html/fcl/fpjson/index.html

Flattening the object and array might be the most difficult part, everything else is trivial.

 

TinyPortal © 2005-2018