# StructArrays and custom data layout

**URL:** <https://discourse.julialang.org/t/structarrays-and-custom-data-layout/34910>\
**Category:** General Usage\
**Tags:** structarrays\
**Created:** [February 20, 2020, 3:33pm UTC](https://discourse.julialang.org/t/structarrays-and-custom-data-layout/34910 "2020-02-20T15:33:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kruxigt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kruxigt/32/11694_2.png) [@Kruxigt](https://discourse.julialang.org/u/Kruxigt)\
**Post date:** [February 20, 2020, 3:33pm UTC](https://discourse.julialang.org/t/structarrays-and-custom-data-layout/34910/1 "2020-02-20T15:33:53Z")

</div>

Hello fine fellows!

I’m trying to use [StructArrays](https://github.com/JuliaArrays/StructArrays.jl) for a custom data layout. Basically, I would like the following to produce a StructArray that includes the parameters field:

```julia
using StructArrays
struct MyStruct
   data::Dict
end

struct MyData
   parameters::Array
end

p = [1,2]
p2 = [3,4]
s1 = MyStruct(Dict(:MyData => MyData(p)))
s2 = MyStruct(Dict(:MyData => MyData(p2)))

StructArray([s1, s2])

```

If done naively like above, it does not include the parameters field

I know that I have to overload the `getproperty(ms::MyStruct)` function and then overload the `StructArrays.staticschema` and `StructArrays.createinstance` ([example here](https://github.com/JuliaArrays/StructArrays.jl#advanced-structures-with-non-standard-data-layout)) functions in order for StructArrays to include the `parameters` field.

Can anyone point me in the right direction?  
Thanks! /Robin
