Jump to content
Sign in to follow this  
qwerty3321

creating .json file

Recommended Posts

3 hours ago, qwerty3321 said:

could you give me a small example please?

No.  You haven't given any information about your "normal" text file.

Share this post


Link to post
Share on other sites

There does not appear to be anything standard about that 'normal' file. I don't think I've ever seen such a file before.

To give you a clear picture of the complexity of what you are asking, and why drjd is quite right....just looking at that example I would assume the following about your file:

  • The entire file is a single json object
  • The first line is the 1 and only key within that object
  • there is a CRLF between the key and its value
  • The rest of the file is the value of the single key
  • The single element is itself an object
  • This object consists of key-value pairs separated by "-" and delimited by CRLF
  • Every value is a string
  • Your file cannot contain strings which contain CRLF

Following these rules, your json output would be: 

{"Details": {"Name":"abc", "Organization": "anonymous", "Location": "xyz"}}

If that is what you want, then my only answer is that you will have to procedurally parse the entire file from a string and construct the json object manually.

If that is not what you want, then you should figure out the rules for your "normal simple" file. Once you figure out the rules, you will still have to manually write the code because that isn't a standard computer-parse-able format that I am aware of.

If there are no rules, then you may need to consider a different strategy for whatever it is you are actually trying to accomplish. For example if you are making your files into json to make them easier for a computer to parse, then you'd be better of just shoving all these "normal simple" text files into elastic search or splunk and never look at them again.

Share this post


Link to post
Share on other sites

In your diagram, probe #2 is your object. You need to convert it to your specific cluster. The text you are showing is JSON format, what else do you want? .JSON files are text files.

The JSON Library I used is Labview JSON

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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