Recent

Author Topic: How to setup JSON response handler to handle incoming request for JSON data?  (Read 509 times)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 460
  • Programming is FUN only when it works :)
    • Cool Technology
Hi,

I have been playing with JSON data in my programming projects. I have figured out how to post or send JSON URL request to a server and parse JSON data within Lazarus projects.

Now, I want to setup a server that will respond with JSON data back to a client from within Lazarus program. I have looked into it on the Internet and I kept coming across JSON server. However, they say JSON server is so basic that it lacks security and it should never be used but only for TESTING PURPOSES.

As you can see, I am a beginner in this area. So, what should I do? First setup web server? LAMP or something similar? Then, Lazarus JSON response handler? Any sample JSON response handler code will be greatly appreciated.

Thanks in advance.

rvk

  • Hero Member
  • *****
  • Posts: 6585
I have looked into it on the Internet and I kept coming across JSON server. However, they say JSON server is so basic that it lacks security and it should never be used but only for TESTING PURPOSES.
Not sure what "JSON server" is.... but I assume they mean a server that gives back JSON. It's not a specific program but any server can serve JSON back to the client.

Now, I want to setup a server that will respond with JSON data back to a client from within Lazarus program.
What exactly is the JSON response? Is it data from your program? Is it data from a database?

If you have JSON in your Lazarus program, why don't you program a web-server in Lazarus itself and send JSON back that way.
You can start with the examples in fpc\packages\fcl-web\examples.

Otherwise you need to make clear where the JSON comes from that you want to serve to the clients.

 

TinyPortal © 2005-2018