Use this JavaScript code to convert your string/base58 private key to a json array.
constfs=require('fs');const { Keypair } =require('@solana/web3.js');constbs58=require('bs58');constbase58PrivateKey='private key as string here...';constuint8ArrayPrivateKey=bs58.decode(base58PrivateKey);// Create a Keypair from the Uint8Arrayconstkeypair=Keypair.fromSecretKey(uint8ArrayPrivateKey);// Write the keypair to a JSON file in same directoryconstkeypairPath='./keypair.json';fs.writeFileSync(keypairPath,`[${Array.from(keypair.secretKey)}]`);