Say I have a JSON object
var student = {name: "Anil", Age: 27};
student.Age = 30; // I want to restrict this code.
Please help me to understand, how can we make JSON object read only type.
Say I have a JSON object
var student = {name: "Anil", Age: 27};
Know the answer? Post it. Somebody with the same question will find it here.

Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajeev PunhaniRank #551 · 4.4K reputationPosted Aug 2, 2016, 8:55 PM EDT
HiAnil,
For making object as read-only you can use
If the above solution is helpful then,accept the answer.
Joginder BangerRank #360 · 7K reputationPosted Aug 2, 2016, 7:52 AM EDT
Vinay SinghRank #604 · 4K reputationPosted Aug 2, 2016, 11:33 PM EDT
Suthish NairRank #92 · 22.8K reputationPosted Aug 2, 2016, 11:43 PM EDT