user4596: Let's say I have validator, which checks datum against two numbers, hash, time and a string and there are some funds locked at this script address and I would like to unlock these funds using cardano-cli --tx-in-datum-file... by providing datum file. Inside source code I have a custom data type like so:
data CustomDatum = CustomDatum
    { num1 :: Integer
    , num2 :: Integer
    , hash1 :: PubKeyHash
    , time1 :: POSIXTime
    , string1 :: String
    }
    deriving Show

PlutusTx.unstableMakeIsData ''VestingDatum

What are the rules to form correct datum file?
How should typed and not typed datum file look like to match my CustomDatum inside Plutus script?
How are values mapped between datum file and custom data inside Plutus script?

user2656: Here is an example of a haskell executable that will convert any of your custom data types to the right JSON format :
https://github.com/OnChainLabs/Martify/blob/main/app/datum-json.hs
In this file we convert the type NFTSale which is defined like so :
data NFTSale = NFTSale
    { nSeller    :: !PubKeyHash
    , nPrice     :: !Integer
    , nCurrency  :: !CurrencySymbol
    , nToken     :: !TokenName
    } deriving (Generic, ToJSON, FromJSON)

But it works for any other data type.

4596: <p>Let's say I have validator, which checks datum against two numbers, hash, time and a string and there are some funds locked at this script address and I would like to unlock these funds using <code>cardano-cli --tx-in-datum-file...</code> by providing datum file. Inside source code I have a custom data type like so:</p>
<pre><code>data CustomDatum = CustomDatum
    { num1 :: Integer
    , num2 :: Integer
    , hash1 :: PubKeyHash
    , time1 :: POSIXTime
    , string1 :: String
    }
    deriving Show

PlutusTx.unstableMakeIsData ''VestingDatum
</code></pre>
<p>What are the rules to form correct datum file?</p>
<p>How should typed and not typed datum file look like to match my <code>CustomDatum</code> inside Plutus script?</p>
<p>How are values mapped between datum file and custom data inside Plutus script?</p>
 2656: <p>Here is an example of a haskell executable that will convert any of your custom data types to the right JSON format :
<a href="https://github.com/OnChainLabs/Martify/blob/main/app/datum-json.hs" rel="nofollow noreferrer">https://github.com/OnChainLabs/Martify/blob/main/app/datum-json.hs</a></p>
<p>In this file we convert the type <code>NFTSale</code> which is defined like so :</p>
<pre><code>data NFTSale = NFTSale
    { nSeller    :: !PubKeyHash
    , nPrice     :: !Integer
    , nCurrency  :: !CurrencySymbol
    , nToken     :: !TokenName
    } deriving (Generic, ToJSON, FromJSON)
</code></pre>
<p>But it works for any other data type.</p>
