Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "parseResponse.files[i].content.data;" aways null #9

Open
juniorgasparotto opened this issue Dec 31, 2021 · 0 comments
Open

The "parseResponse.files[i].content.data;" aways null #9

juniorgasparotto opened this issue Dec 31, 2021 · 0 comments

Comments

@juniorgasparotto
Copy link

Hi,

I'm trying to get the value of the data property from the response object path of the parser method, but it always returns null, I had to do a fix using JSON.stringfy to get what I wanted, can I Help with the reason for this behavior?

const uploadFiles = async function (event) {        
    var r = await parser.parse(event);

	if (r.files.length > 0) {
		for (var i in r.files) {
                   ********************* THE PROBLEM HERE
		   // THIS aways return "NULL", why?? 
		   var data = r.files[i].content.data; 
                   console.log(data); // AWAYS null            ​

                   ********************* THE FIX HERE
		   ​// FIX To get de "data" property
		   ​var objSerialized = JSON.stringify(r.files[i]);
		   ​var data2 = JSON.parse(objSerialized);
		   console.log(data2); // ITS ok
	   }
	}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant