I just realized I posted this in sqlalchemy but it's a React issue. Sorry
for the confusion. I'll find an appropriate React group somewhere.
Dale
On Thursday, August 20, 2020 at 1:23:22 PM UTC-5 Dale Preston wrote:
> Just more info; if I change res => res.json() to res => res.text(), I get
Just more info; if I change res => res.json() to res => res.text(), I get
the json as text.
*{ "users": [ { "emailaddress": "bobsm...@somedomain.com", "firstname":
"Bob", "lastname": "Smith", "userid": "bsmith" }, { "emailaddress":
"tomjones @otherdomain.com", "firstname": "Tom", "lastname":
I have a flask API that returns valid JSON. The Content-Type is
application/json. I assign it to state using useEffect. When I call on
the variable returned by useEffect, I get the error: *Error: Objects are
not valid as a React child*.
I know that React is reading the JSON because I get
If you want to get an attribute of an object where the name of the
attribute is variable, you can use the getattr function:
attrname = "lastname"
column = getattr(User, attrname)
for item in session.query(column):
print(item)
or:
attrname = "lastname"
for user in session.query(User):