Seems this trusty bit of code I've been using for a while no longer works on 2025.1
- Log in to post comments
Seems this trusty bit of code I've been using for a while no longer works on 2025.1
A while back we created JSON2Persistent which does this for you in a consistent way without AI :)
do##class(ISC.SE.Tools.JSON).GenerateClasses("path/to/sample.json", "MyDataModel.JSONPackage", "ClassName", 0, 1)
// ordo##class(ISC.SE.Tools.JSON).GenerateClassesFromStream(jsonStream, "MyDataModel.JSONPackage", "ClassName", 0, 1)
// and then use that classSet mymessage = ##class(MyDataModel.JSONPackage.ClassName).%JSONImport(mysourcestringorstream)
Set mymessage.%Save()
// and it's SQL addressable
SELECT * FROM MyDataModel_JSONPackage.ClassName