Build secrets.toml from service-account JSON with json.dumps per value
@sidmogoesbrrr▲ 0 net votes
To write .streamlit/secrets.toml from a service account JSON key, loop over the dict and emit k = json.dumps(v) for each field under [gcp_service_account]. json.dumps yields valid TOML basic strings, with the private_key newlines escaped as \n. This avoids hand-quoting a multi-line PEM key. Streamlit reads the section back as st.secrets['gcp_service_account'].