Astik Thombare
Tera Sage

Hi @Aditya_hublikar 

 

When you use GlideAjax (Script Include ↔ Client Script), you’re not just calling a JavaScript function directly — you’re actually making an HTTP request from the browser to the server and back.

HTTP (and GlideAjax built on top of it) only knows how to send/receive data as text (string). It doesn’t understand native JavaScript objects or arrays

 

That’s why:

On the server side, even if you build an object/array, you must convert it into a string (JSON.stringify) so it can travel over the network as plain text.

On the client side, you take that string and turn it back into a usable JavaScript object (JSON.parse).

 

If ServiceNow allowed sending native objects directly, the browser and server would have to share the same memory space and JavaScript runtime — which isn’t possible in a request/response model. The only universal, lightweight way to transfer structured data is via a serialized string format (like JSON or XML).

 

👉 So the short answer: We send only strings because GlideAjax works over HTTP, and HTTP transfers data as text. Objects/arrays must first be serialized (stringified) to be transmitted.

 

If my answer helped you, please consider marking it as Correct and giving it a 👍 Helpful — it might help other members in the community too!

 

Thanks,
Astik T
ServiceNow Community Rising Star 2025 🌟