+ 1
how can I make a file extractor in javascript?
guys I have a task to make a file extractor. it gets text file and converts its data to js object how should I write the code?
5 Respostas
+ 3
Amir Yeganeh you asked about alternatives to json
here is a short list:
https://stackshare.io/json/alternatives
+ 1
Amir Yeganeh I believe you are looking for this https://www.geeksforgeeks.org/converting-json-text-to-javascript-object/amp/
+ 1
BroFar yeah that's so similar to my task
but is there a way doing it without using json?
+ 1
BroFar
We need a nodejs app in order to extract some data from a text file and create a javascript object from the data.
1. The file is a data structure as bellow:
............................
`
//data.txt
Name: amir
Family: yeg
Address:
City: Tehran
Country: Iran
Contact:
Phone: 09000900
Email: example@gmail.com
`
so the object should look like this after processing.
`
data = {
Name: amir,
Family: yeg,
Address: {
City: Tehran,
....
Contacts: {
Phone: 09000900,
Email: example@gmail.com
}
}
}
`
this is what I want
+ 1
BroFar thanks👍👋