Jump to content

Bundling Values from ini file into complex Cluster

Recommended Posts

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

Link to comment

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.

  • Like 1
Link to comment

Here is a quick hack from some existing INI parsing code I had.  See if this works on NI-MAX files.

2022-06-22 09_59_21-INI to JSON Example.vi Front Panel on Untitled Project 2_My Computer.png

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 by drjdpowell
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.