rareresident Posted June 20, 2022 Report Share Posted June 20, 2022 Hello guys, iam trying to converte Ni-Max ini files into Json files. I found a way to list all sections, keys and values and also to create the json file. What Iam struggling with is the conversion itself. I have to get the values into the right spot of the output cluster, which is pretty complex. How can I bundle the values in such a way that it will be displayed correctly in the output cluster? testfahrt1 - Kopie.vi Quote Link to comment
Mads Posted June 21, 2022 Report Share Posted June 21, 2022 One option, perhaps not as flexible as you want but still: OpenG Configuration file VIs can read the ini-file and convert it to clusters, which could then be converted to json using e.g. @drjdpowell's JSONtext... To get up and running with a more flexible solution (i.e. without the need for defined clusters) you could probably pick and merge parts from those two libraries. 1 Quote Link to comment
drjdpowell Posted June 22, 2022 Report Share Posted June 22, 2022 (edited) Here is a quick hack from some existing INI parsing code I had. See if this works on NI-MAX files. This VI converts the INI items to JSONpath notation, converts the values to JSON strings unless already a valid JSON value (such and numbers, true, etc.), and uses the JSONtext VIs "Unflatten JSONpath Array to Object" and "Pretty Print" to convert to JSON. INI to JSON Example.vi Edited June 22, 2022 by drjdpowell Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.