WordPress has many built in functions that allow you to get whatever data you have added to your posts, whether it standard or custom. Example below:
if ($query->have_posts()) {
while ($query->have_posts()) {
$posts = $query->get_posts();
$array['title'] = get_the_title();
$array['permalink'] = get_the_permalink();
$array['content'] = get_the_content();
$array['post_date'] = get_the_date();
if (has_post_thumbnail()) {
$array['feat_image_url'] = wp_get_attachment_url(get_post_thumbnail_id());
}
$array['custom_meta_1'] = get_post_meta($post->ID, '_some_post_meta_1', true);
$array['custom_meta_2'] = get_post_meta($post->ID, '_some_post_meta_2', true);
}
wp_reset_postdata();
print_r($array);
}
You can then use $array
to create your Json.
Just a few as example above and links below for you study. You eally should read through the codex, or at least bookmark it and use it for future reference.